Skip to content

Commit 0e4880f

Browse files
committed
fix(core): use form batch to sync errors in array state exchanging
1 parent 3d077e9 commit 0e4880f

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

packages/core/src/externals.ts

+7-5
Original file line numberDiff line numberDiff line change
@@ -193,8 +193,8 @@ export const createFormExternals = (
193193
delete patchState.values
194194
Object.assign(state, patchState)
195195
}
196-
syncFormMessages('errors', state, true)
197-
syncFormMessages('warnings', state, true)
196+
syncFormMessages('errors', state)
197+
syncFormMessages('warnings', state)
198198
})
199199
}
200200
if (currentField) {
@@ -228,9 +228,11 @@ export const createFormExternals = (
228228
const currentTags = parseArrayTags(published.value)
229229
if (!isEqual(prevTags, currentTags)) {
230230
const removedTags = calculateRemovedTags(prevTags, currentTags)
231-
eachArrayExchanges(field.prevState, published, (prev, current) =>
232-
exchangeState(path, prev, current)
233-
)
231+
form.batch(() => {
232+
eachArrayExchanges(field.prevState, published, (prev, current) =>
233+
exchangeState(path, prev, current)
234+
)
235+
})
234236
removeArrayNodes(removedTags)
235237
//重置TAG,保证下次状态交换是没问题的
236238
setFormValuesIn(

0 commit comments

Comments
 (0)