Skip to content

Commit

Permalink
fix: query tab content disappears reordering or closing other tabs, c…
Browse files Browse the repository at this point in the history
…loses #261
  • Loading branch information
Fabio286 committed May 15, 2022
1 parent a082514 commit c5baf2b
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions src/renderer/components/WorkspaceTabQuery.vue
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,8 @@ export default {
durationsCount: 0,
affectedCount: null,
editorHeight: 200,
isHistoryOpen: false
isHistoryOpen: false,
debounceTimeout: null
};
},
computed: {
Expand Down Expand Up @@ -285,6 +286,19 @@ export default {
}
},
watch: {
query (val) {
clearTimeout(this.debounceTimeout);
this.debounceTimeout = setTimeout(() => {
this.updateTabContent({
uid: this.connection.uid,
tab: this.tab.uid,
type: 'query',
schema: this.selectedSchema,
content: val
});
}, 200);
},
isSelected (val) {
if (val) {
this.changeBreadcrumbs({ schema: this.selectedSchema, query: `Query #${this.tab.index}` });
Expand Down Expand Up @@ -357,13 +371,6 @@ export default {
return acc + (curr.report ? curr.report.affectedRows : 0);
}, null);
this.updateTabContent({
uid: this.connection.uid,
tab: this.tab.uid,
type: 'query',
schema: this.selectedSchema,
content: query
});
this.saveHistory(params);
if (!this.autocommit)
this.setUnsavedChanges({ uid: this.connection.uid, tUid: this.tabUid, isChanged: true });
Expand Down

0 comments on commit c5baf2b

Please sign in to comment.