Browse Source

fix: disable auto save for pk values

pull/8371/head
mertmit 7 months ago
parent
commit
f0ee389b8b
  1. 15
      packages/nc-gui/components/smartsheet/Cell.vue

15
packages/nc-gui/components/smartsheet/Cell.vue

@ -112,6 +112,17 @@ const syncValue = useDebounceFn(
{ maxWait: 2000 }, { maxWait: 2000 },
) )
const saveTimer = ref<NodeJS.Timeout>()
const updateWhenEditCompleted = () => {
if (editEnabled.value) {
if (saveTimer.value) clearTimeout(saveTimer.value)
saveTimer.value = setTimeout(updateWhenEditCompleted, 500)
} else {
emit('save')
}
}
const vModel = computed({ const vModel = computed({
get: () => { get: () => {
return props.modelValue return props.modelValue
@ -122,7 +133,9 @@ const vModel = computed({
} else if (val !== props.modelValue) { } else if (val !== props.modelValue) {
currentRow.value.rowMeta.changed = true currentRow.value.rowMeta.changed = true
emit('update:modelValue', val) emit('update:modelValue', val)
if (isAutoSaved(column.value)) { if (column.value.pk) {
updateWhenEditCompleted()
} else if (isAutoSaved(column.value)) {
syncValue() syncValue()
} else if (!isManualSaved(column.value)) { } else if (!isManualSaved(column.value)) {
emit('save') emit('save')

Loading…
Cancel
Save