Skip to content

Commit

Permalink
fix(core): use form batch to sync errors in array state exchanging
Browse files Browse the repository at this point in the history
  • Loading branch information
janryWang committed Jul 9, 2020
1 parent 3d077e9 commit 0e4880f
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/core/src/externals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ export const createFormExternals = (
delete patchState.values
Object.assign(state, patchState)
}
syncFormMessages('errors', state, true)
syncFormMessages('warnings', state, true)
syncFormMessages('errors', state)
syncFormMessages('warnings', state)
})
}
if (currentField) {
Expand Down Expand Up @@ -228,9 +228,11 @@ export const createFormExternals = (
const currentTags = parseArrayTags(published.value)
if (!isEqual(prevTags, currentTags)) {
const removedTags = calculateRemovedTags(prevTags, currentTags)
eachArrayExchanges(field.prevState, published, (prev, current) =>
exchangeState(path, prev, current)
)
form.batch(() => {
eachArrayExchanges(field.prevState, published, (prev, current) =>
exchangeState(path, prev, current)
)
})
removeArrayNodes(removedTags)
//重置TAG,保证下次状态交换是没问题的
setFormValuesIn(
Expand Down

0 comments on commit 0e4880f

Please sign in to comment.