From dc2cfa0536ad95f5f876934f9370712def81b946 Mon Sep 17 00:00:00 2001 From: unclechong <546177072@qq.com> Date: Wed, 24 Jan 2024 15:57:59 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=20baseReadtion=20=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E6=89=A7=E8=A1=8C=E4=B8=A4=E6=AC=A1=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit patchSchemaCompile 收集了 field.initialized field在初始化结束后会标记 field.initialized = true 所以 base reacttion 全部都会执行两次 修复:field.initialized 丢在 untracked 中,不在进行收集 --- packages/json-schema/src/compiler.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/json-schema/src/compiler.ts b/packages/json-schema/src/compiler.ts index cc2a27c56e4..7f0037eba41 100644 --- a/packages/json-schema/src/compiler.ts +++ b/packages/json-schema/src/compiler.ts @@ -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) }