diff options
author | Phil Hughes <me@iamphill.com> | 2018-03-27 13:57:58 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-03-28 16:08:32 +0300 |
commit | a515b459299e547b867408c9095af6e1ce427fff (patch) | |
tree | 3d489b45b89eda535db6baa91568fca24426f392 /app/assets/javascripts/ide/ide_router.js | |
parent | 89bb7b85ec1479cd46f758512891714d81eeb807 (diff) |
remove extra state property
pending tabs now get added into openfiles & just filtered correctly
Diffstat (limited to 'app/assets/javascripts/ide/ide_router.js')
-rw-r--r-- | app/assets/javascripts/ide/ide_router.js | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/app/assets/javascripts/ide/ide_router.js b/app/assets/javascripts/ide/ide_router.js index db89c1d44db..25f55ac2f8a 100644 --- a/app/assets/javascripts/ide/ide_router.js +++ b/app/assets/javascripts/ide/ide_router.js @@ -76,11 +76,17 @@ router.beforeEach((to, from, next) => { .then(() => { if (to.params[0]) { const path = - to.params[0].slice(-1) === '/' - ? to.params[0].slice(0, -1) - : to.params[0]; - const treeEntry = store.state.entries[path]; - if (treeEntry) { + to.params[0].slice(-1) === '/' ? to.params[0].slice(0, -1) : to.params[0]; + const treeEntry = Object.keys(store.state.entries).reduce((acc, key) => { + const file = store.state.entries[key]; + if (key === path && !file.pending) { + return file; + } + + return acc; + }, {}); + + if (Object.keys(treeEntry).length) { store.dispatch('handleTreeEntryAction', treeEntry); } } |