From f0ee389b8baf3ef233e67f7197e25eac189a8444 Mon Sep 17 00:00:00 2001 From: mertmit Date: Tue, 30 Apr 2024 17:12:25 +0000 Subject: [PATCH] fix: disable auto save for pk values --- packages/nc-gui/components/smartsheet/Cell.vue | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/packages/nc-gui/components/smartsheet/Cell.vue b/packages/nc-gui/components/smartsheet/Cell.vue index fb8fb8d7c4..75fa3ebb0b 100644 --- a/packages/nc-gui/components/smartsheet/Cell.vue +++ b/packages/nc-gui/components/smartsheet/Cell.vue @@ -112,6 +112,17 @@ const syncValue = useDebounceFn( { maxWait: 2000 }, ) +const saveTimer = ref() + +const updateWhenEditCompleted = () => { + if (editEnabled.value) { + if (saveTimer.value) clearTimeout(saveTimer.value) + saveTimer.value = setTimeout(updateWhenEditCompleted, 500) + } else { + emit('save') + } +} + const vModel = computed({ get: () => { return props.modelValue @@ -122,7 +133,9 @@ const vModel = computed({ } else if (val !== props.modelValue) { currentRow.value.rowMeta.changed = true emit('update:modelValue', val) - if (isAutoSaved(column.value)) { + if (column.value.pk) { + updateWhenEditCompleted() + } else if (isAutoSaved(column.value)) { syncValue() } else if (!isManualSaved(column.value)) { emit('save')