From da8cc39157a4b507d3d377ee1e888b8f8a52b7c5 Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Fri, 20 Sep 2024 18:08:11 +0200 Subject: [PATCH] fix: mismatch between table field columns and results with duplicate fields, fixes #848 --- src/renderer/components/WorkspaceTabQueryTable.vue | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/renderer/components/WorkspaceTabQueryTable.vue b/src/renderer/components/WorkspaceTabQueryTable.vue index a4b8396d..0d8ef694 100644 --- a/src/renderer/components/WorkspaceTabQueryTable.vue +++ b/src/renderer/components/WorkspaceTabQueryTable.vue @@ -38,7 +38,7 @@
{ const resultsWithRows = computed(() => props.results.filter(result => result.rows.length)); const fields = computed(() => resultsWithRows.value.length ? resultsWithRows.value[resultsetIndex.value].fields : []); +const filteredFields = computed(() => fields.value.reduce((acc, cur) => { + if (acc.findIndex(f => JSON.stringify(f) === JSON.stringify(cur))) + acc.push(cur); + return acc; +}, [] as TableField[])); const keyUsage = computed(() => resultsWithRows.value.length ? resultsWithRows.value[resultsetIndex.value].keys : []); const fieldsObj = computed(() => {