Browse Source

Reset field value to default value if default value changes

pull/3776/head
Andrew Kingston 5 years ago
parent
commit
ff246de1cb
  1. 9
      packages/client/src/components/app/forms/InnerForm.svelte

9
packages/client/src/components/app/forms/InnerForm.svelte

@ -102,8 +102,15 @@
const existingField = getField(field) const existingField = getField(field)
if (existingField) { if (existingField) {
const { fieldState } = get(existingField) const { fieldState } = get(existingField)
initialValue = fieldState.value ?? initialValue
fieldId = fieldState.fieldId fieldId = fieldState.fieldId
// Use new default value if default value changed,
// otherwise use the current value if possible
if (defaultValue !== fieldState.defaultValue) {
initialValue = defaultValue
} else {
initialValue = fieldState.value ?? initialValue
}
} }
// Auto columns are always disabled // Auto columns are always disabled

Loading…
Cancel
Save