Skip to content

Commit

Permalink
修复 baseReadtion 初始化执行两次的问题
Browse files Browse the repository at this point in the history
patchSchemaCompile 收集了 field.initialized
field在初始化结束后会标记  field.initialized = true
所以 base reacttion 全部都会执行两次

修复:field.initialized 丢在 untracked 中,不在进行收集
  • Loading branch information
unclechong authored Jan 24, 2024
1 parent 3fa68e6 commit dc2cfa0
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/json-schema/src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,11 @@ export const patchSchemaCompile = (
})
if (compiled === undefined) return
if (demand) {
if (collected || !targetState.initialized) {
patchStateFormSchema(targetState, path, compiled)
}
untracked(() => {
if (collected || !targetState.initialized) {
patchStateFormSchema(targetState, path, compiled)
}
})
} else {
patchStateFormSchema(targetState, path, compiled)
}
Expand Down

0 comments on commit dc2cfa0

Please sign in to comment.