Browse Source

fix: active field update issue

pull/7376/head
Ramesh Mane 12 months ago
parent
commit
0ff78bc234
  1. 17
      packages/nc-gui/components/smartsheet/details/Fields.vue

17
packages/nc-gui/components/smartsheet/details/Fields.vue

@ -268,8 +268,10 @@ const duplicateField = async (field: TableExplorerColumn) => {
const onFieldUpdate = (state: TableExplorerColumn) => {
const col = fields.value.find((col) => compareCols(col, state))
if (!col) return
const diffs = diff(col, state)
if (Object.keys(diffs).length === 0 || (Object.keys(diffs).length === 1 && 'altered' in diffs)) {
if (Object.keys(diffs).length === 0 || (Object.keys(diffs).length === 1 && 'altered' in diffs) || isUpdated) {
ops.value = ops.value.filter((op) => op.op === 'add' || !compareCols(op.column, state))
} else {
const field = ops.value.find((op) => compareCols(op.column, state))
@ -299,9 +301,6 @@ const onFieldUpdate = (state: TableExplorerColumn) => {
column: state,
})
}
if (activeField.value) {
activeField.value = state
}
}
}
@ -720,6 +719,16 @@ const onFieldOptionUpdate = () => {
isFieldIdCopied.value = false
}, 200)
}
watch(
fields,
() => {
if (activeField.value) {
activeField.value = fields.value.find((field) => field.id === activeField.value.id) || activeField.value
}
},
{ deep: true },
)
</script>
<template>

Loading…
Cancel
Save