From e2de45db23f43f91f3538b1a38900ceb37098bdd Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Mon, 26 Jul 2021 17:01:29 +0200 Subject: [PATCH] implement review comments --- packages/standard-components/src/forms/InnerForm.svelte | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/standard-components/src/forms/InnerForm.svelte b/packages/standard-components/src/forms/InnerForm.svelte index cd135c1551..05ef468165 100644 --- a/packages/standard-components/src/forms/InnerForm.svelte +++ b/packages/standard-components/src/forms/InnerForm.svelte @@ -119,20 +119,19 @@ const clearValue = () => { const { fieldState } = fieldMap[field] + const newValue = initialValues[field] ?? defaultValue; fieldState.update(state => { - state.value = defaultValue + state.value = newValue state.error = null return state }) formState.update(state => { - state.values = { ...state.values, [field]: defaultValue } + state.values = { ...state.values, [field]: newValue } delete state.errors[field] state.valid = Object.keys(state.errors).length === 0 return state }) - - return true } return {