Merge pull request #9629 from Budibase/fix/formula-column-edit

Reactivity fix for the Create/Edit column modal.
This commit is contained in:
deanhannigan 2023-02-10 09:00:55 +00:00 committed by GitHub
commit ed5bb5e7cc
1 changed files with 18 additions and 9 deletions

View File

@ -75,16 +75,20 @@
editableColumn.constraints.presence = { allowEmpty: false } editableColumn.constraints.presence = { allowEmpty: false }
} }
$: if (field && !savingColumn) { const initialiseField = (field, savingColumn) => {
editableColumn = cloneDeep(field) if (field && !savingColumn) {
originalName = editableColumn.name ? editableColumn.name + "" : null editableColumn = cloneDeep(field)
linkEditDisabled = originalName != null originalName = editableColumn.name ? editableColumn.name + "" : null
isCreating = originalName == null linkEditDisabled = originalName != null
primaryDisplay = isCreating = originalName == null
$tables.selected.primaryDisplay == null || primaryDisplay =
$tables.selected.primaryDisplay === editableColumn.name $tables.selected.primaryDisplay == null ||
$tables.selected.primaryDisplay === editableColumn.name
}
} }
$: initialiseField(field, savingColumn)
$: checkConstraints(editableColumn) $: checkConstraints(editableColumn)
$: required = !!editableColumn?.constraints?.presence || primaryDisplay $: required = !!editableColumn?.constraints?.presence || primaryDisplay
$: uneditable = $: uneditable =
@ -583,7 +587,12 @@
title="Formula" title="Formula"
label="Formula" label="Formula"
value={editableColumn.formula} value={editableColumn.formula}
on:change={e => (editableColumn.formula = e.detail)} on:change={e => {
editableColumn = {
...editableColumn,
formula: e.detail,
}
}}
bindings={getBindings({ table })} bindings={getBindings({ table })}
allowJS allowJS
/> />