From 1b04b216b21b697e47062a9366bc1b6a040a1a72 Mon Sep 17 00:00:00 2001 From: Fabio Date: Mon, 14 Sep 2020 11:08:11 +0200 Subject: [PATCH] fix: cell update soft reload doesn't apply changes --- src/renderer/components/WorkspaceQueryTable.vue | 7 +++++-- src/renderer/components/WorkspaceTableTab.vue | 8 ++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/renderer/components/WorkspaceQueryTable.vue b/src/renderer/components/WorkspaceQueryTable.vue index 0e7a5261..d27ed8cf 100644 --- a/src/renderer/components/WorkspaceQueryTable.vue +++ b/src/renderer/components/WorkspaceQueryTable.vue @@ -257,10 +257,13 @@ export default { } }, applyUpdate (params) { - const { primary, id, field, content } = params; + const { primary, id, field, table, content } = params; + this.localResults = this.localResults.map(row => { - if (row[primary] === id) + if (row[primary] === id)// only fieldName row[field] = content; + else if (row[`${table}.${primary}`] === id)// table.fieldName + row[`${table}.${field}`] = content; return row; }); diff --git a/src/renderer/components/WorkspaceTableTab.vue b/src/renderer/components/WorkspaceTableTab.vue index b45320e5..22b17882 100644 --- a/src/renderer/components/WorkspaceTableTab.vue +++ b/src/renderer/components/WorkspaceTableTab.vue @@ -35,7 +35,7 @@ v-if="results" v-show="!isQuering" ref="queryTable" - :results="[results]" + :results="results" :tab-uid="tabUid" @update-field="updateField" @delete-selected="deleteSelected" @@ -72,7 +72,7 @@ export default { return { tabUid: 'data', isQuering: false, - results: {}, + results: [], fields: [], keyUsage: [], lastTable: null, @@ -116,7 +116,7 @@ export default { async getTableData () { if (!this.table) return; this.isQuering = true; - this.results = {}; + this.results = []; const fieldsArr = []; const keysArr = []; this.setTabFields({ cUid: this.connection.uid, tUid: this.tabUid, fields: [] }); @@ -144,7 +144,7 @@ export default { const { status, response } = await Tables.getTableData(params); if (status === 'success') - this.results = response; + this.results = [response]; else this.addNotification({ status: 'error', message: response }); }