From 55932fe11583bd5ff48f82b8408965adba4f5071 Mon Sep 17 00:00:00 2001 From: Fabio Di Stasio Date: Thu, 8 Apr 2021 17:47:10 +0200 Subject: [PATCH] fix: cell edit doesn't properly use primary or unique index to update if both present, closes #51 --- src/renderer/components/WorkspaceQueryTable.vue | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/renderer/components/WorkspaceQueryTable.vue b/src/renderer/components/WorkspaceQueryTable.vue index 85e09121..d8b44786 100644 --- a/src/renderer/components/WorkspaceQueryTable.vue +++ b/src/renderer/components/WorkspaceQueryTable.vue @@ -123,12 +123,13 @@ export default { return this.getWorkspace(this.connUid).breadcrumbs.schema; }, primaryField () { - const primaryFields = this.fields.filter(field => ['pri', 'uni'].includes(field.key)); + const primaryFields = this.fields.filter(field => field.key === 'pri'); + const uniqueFields = this.fields.filter(field => field.key === 'uni'); - if (primaryFields.length > 1 || !primaryFields.length) + if ((primaryFields.length > 1 || !primaryFields.length) && (uniqueFields.length > 1 || !uniqueFields.length)) return false; - return primaryFields[0]; + return primaryFields[0] || uniqueFields[0]; }, isSortable () { return this.fields.every(field => field.name);