From f7a368f802400b23229e497c17afa8ee3902fda7 Mon Sep 17 00:00:00 2001 From: Sheldon Guo Date: Thu, 24 Oct 2024 09:29:43 +0800 Subject: [PATCH] refactor(form): optimize useDataFormItemProps hook (#5484) --- .../blocks/data-blocks/form/hooks/useDataFormItemProps.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/modules/blocks/data-blocks/form/hooks/useDataFormItemProps.ts b/packages/core/client/src/modules/blocks/data-blocks/form/hooks/useDataFormItemProps.ts index b9e50ff5f0..934e66acc5 100644 --- a/packages/core/client/src/modules/blocks/data-blocks/form/hooks/useDataFormItemProps.ts +++ b/packages/core/client/src/modules/blocks/data-blocks/form/hooks/useDataFormItemProps.ts @@ -8,9 +8,10 @@ */ import { useForm } from '@formily/react'; +import { useCollectionRecordData } from '../../../../../data-source/collection-record/CollectionRecordProvider'; import { useSatisfiedActionValues } from '../../../../../schema-settings/LinkageRules/useActionValues'; export function useDataFormItemProps() { - const form = useForm(); - const { valueMap: style } = useSatisfiedActionValues({ category: 'style', formValues: form?.values }); + const data = useCollectionRecordData(); + const { valueMap: style } = useSatisfiedActionValues({ category: 'style', formValues: data }); return { wrapperStyle: style }; }