From f53d02aee34f2b7d5b8fedb05a0894cbb4dbc52b Mon Sep 17 00:00:00 2001 From: Janry Date: Mon, 18 May 2020 10:17:42 +0800 Subject: [PATCH] fix(core): fix unmounteRemoveValue property is not work #827 (#847) --- packages/core/src/index.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index 76e8ed965d0..b165d2a4b90 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -350,7 +350,7 @@ export function createForm(options: IFormCreatorOptions = {}) { if ( unmountedChanged && (published.display !== false || published.visible === false) && - published.unmountRemoveValue + published.unmountRemoveValue === true ) { if (published.unmounted) { if (isValid(published.value)) { @@ -525,7 +525,6 @@ export function createForm(options: IFormCreatorOptions = {}) { dataPath, computeState, dataType, - unmountRemoveValue, useDirty: isValid(useDirty) ? useDirty : options.useDirty }) field.subscription = { @@ -548,6 +547,10 @@ export function createForm(options: IFormCreatorOptions = {}) { state.initialValue = formInitialValue } + if (isValid(unmountRemoveValue)) { + state.unmountRemoveValue = unmountRemoveValue + } + if (isValid(value)) { // value > formValue > initialValue state.value = value