Commit bfdeee1d authored by Phil Hughes's avatar Phil Hughes

correctly toggle between tabs

parent c5c7baec
...@@ -71,7 +71,7 @@ export default { ...@@ -71,7 +71,7 @@ export default {
this.getRawFileData(this.file) this.getRawFileData(this.file)
.then(() => { .then(() => {
const viewerPromise = this.delayViewerUpdated const viewerPromise = this.delayViewerUpdated
? this.updateViewer('editor') ? this.updateViewer(this.file.pending ? 'diff' : 'editor')
: Promise.resolve(); : Promise.resolve();
return viewerPromise; return viewerPromise;
......
...@@ -37,9 +37,15 @@ export default { ...@@ -37,9 +37,15 @@ export default {
}, },
methods: { methods: {
...mapActions(['closeFile']), ...mapActions(['closeFile', 'updateDelayViewerUpdated', 'openPendingTab']),
clickFile(tab) { clickFile(tab) {
this.$router.push(`/project${tab.url}`); this.updateDelayViewerUpdated(true);
if (tab.pending) {
this.openPendingTab(tab);
} else {
this.$router.push(`/project${tab.url}`);
}
}, },
mouseOverTab() { mouseOverTab() {
if (this.tab.changed) { if (this.tab.changed) {
......
...@@ -80,7 +80,7 @@ export default class Model { ...@@ -80,7 +80,7 @@ export default class Model {
eventHub.$off(`editor.update.model.dispose.${this.file.key}`, this.dispose); eventHub.$off(`editor.update.model.dispose.${this.file.key}`, this.dispose);
eventHub.$off( eventHub.$off(
`editor.update.model.content.${this.file.key}`, `editor.update.model.content.${this.file.path}`,
this.updateContent, this.updateContent,
); );
} }
......
...@@ -92,6 +92,14 @@ export default { ...@@ -92,6 +92,14 @@ export default {
[types.ADD_PENDING_TAB](state, file) { [types.ADD_PENDING_TAB](state, file) {
const pendingTab = state.pendingTabs.find(f => f.path === file.path); const pendingTab = state.pendingTabs.find(f => f.path === file.path);
Object.assign(state, {
openFiles: state.openFiles.map(f =>
Object.assign(f, {
active: false,
}),
),
});
if (pendingTab) { if (pendingTab) {
Object.assign(state, { Object.assign(state, {
pendingTabs: state.pendingTabs.map(tab => ({ pendingTabs: state.pendingTabs.map(tab => ({
...@@ -107,11 +115,6 @@ export default { ...@@ -107,11 +115,6 @@ export default {
pending: true, pending: true,
key: `pending-${file.key}`, key: `pending-${file.key}`,
}), }),
openFiles: state.openFiles.map(f =>
Object.assign(f, {
active: false,
}),
),
}); });
} }
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment