From 9398c2aeec7d78d328e304cc8ebb8e97c5deb443 Mon Sep 17 00:00:00 2001 From: MisicDemone <424532913@qq.com> Date: Mon, 9 Aug 2021 19:01:52 +0800 Subject: [PATCH] fix: prop "scope" of SchemaField not work with reactions --- packages/vue/src/components/RecursionField.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/vue/src/components/RecursionField.ts b/packages/vue/src/components/RecursionField.ts index 3d325661e8a..bf7fd374fd5 100644 --- a/packages/vue/src/components/RecursionField.ts +++ b/packages/vue/src/components/RecursionField.ts @@ -57,10 +57,7 @@ const RecursionField = observer( const createSchema = (schemaProp: IRecursionFieldProps['schema']) => new Schema(schemaProp) const createFieldSchema = (schema: Schema) => - schema.compile?.({ - ...optionsRef.value.scope, - ...scopeRef.value, - }) + schema.compile?.(scopeRef.value) const schemaRef = shallowRef(createSchema(props.schema)) const fieldSchemaRef = shallowRef(createFieldSchema(schemaRef.value)) watch([() => props.schema, scopeRef, optionsRef], () => { @@ -69,7 +66,7 @@ const RecursionField = observer( }) const getPropsFromSchema = (schema: Schema) => - schema?.toFieldProps?.(optionsRef.value) + schema?.toFieldProps?.({ ...optionsRef.value, scope: scopeRef.value }) const fieldPropsRef = shallowRef(getPropsFromSchema(fieldSchemaRef.value)) watch([fieldSchemaRef, optionsRef], () => { fieldPropsRef.value = getPropsFromSchema(fieldSchemaRef.value)