fix: cell edit doesn't properly use primary or unique index to update if both present, closes #51

This commit is contained in:
Fabio Di Stasio 2021-04-08 17:47:10 +02:00
parent d374372e20
commit 55932fe115
1 changed files with 4 additions and 3 deletions

View File

@ -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);