From f07402962464a3516967f5573384e0f41d8e5835 Mon Sep 17 00:00:00 2001 From: Junyi Date: Tue, 8 Oct 2024 16:01:57 +0800 Subject: [PATCH] fix(plugin-workflow): fix field crash in block (#5366) --- .../data-block/DataBlockProvider.tsx | 2 +- .../client/instruction/FormBlockProvider.tsx | 23 ++++++++------- .../AssignedFieldsFormSchemaConfig.tsx | 28 ++++++++++--------- 3 files changed, 29 insertions(+), 24 deletions(-) diff --git a/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx b/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx index 43ab9737a1..11df389b3e 100644 --- a/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx +++ b/packages/core/client/src/data-source/data-block/DataBlockProvider.tsx @@ -122,7 +122,7 @@ export const DataBlockContext = createContext>({} as DataBlockContext.displayName = 'DataBlockContext'; const DataBlockResourceContext = createContext<{ rerenderDataBlock: () => void }>(null); -const RerenderDataBlockProvider: FC = ({ children }) => { +export const RerenderDataBlockProvider: FC = ({ children }) => { const [hidden, setHidden] = React.useState(false); const value = useMemo(() => { return { diff --git a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockProvider.tsx b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockProvider.tsx index 670fa87b10..dcdf300ec2 100644 --- a/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockProvider.tsx +++ b/packages/plugins/@nocobase/plugin-workflow-manual/src/client/instruction/FormBlockProvider.tsx @@ -18,6 +18,7 @@ import { FormBlockContext, FormV2, RecordProvider, + RerenderDataBlockProvider, useAPIClient, useAssociationNames, useBlockRequestContext, @@ -82,16 +83,18 @@ export function FormBlockProvider(props) { - - - - -
{props.children}
-
-
-
+ + + + + +
{props.children}
+
+
+
+
diff --git a/packages/plugins/@nocobase/plugin-workflow/src/client/components/AssignedFieldsFormSchemaConfig.tsx b/packages/plugins/@nocobase/plugin-workflow/src/client/components/AssignedFieldsFormSchemaConfig.tsx index 05ee4910ed..c09fbb0a08 100644 --- a/packages/plugins/@nocobase/plugin-workflow/src/client/components/AssignedFieldsFormSchemaConfig.tsx +++ b/packages/plugins/@nocobase/plugin-workflow/src/client/components/AssignedFieldsFormSchemaConfig.tsx @@ -19,6 +19,7 @@ import { CollectionManagerProvider, CollectionProvider, FormProvider, + RerenderDataBlockProvider, SchemaComponent, SchemaComponentOptions, SchemaComponentProvider, @@ -57,8 +58,7 @@ export function AssignedFieldsFormSchemaConfig(props) { const { setFormValueChanged } = useActionContext(); const api = useAPIClient(); const scope = useWorkflowVariableOptions(); - const nodeForm = useForm(); - const { values, setValuesIn } = nodeForm; + const { values, setValuesIn, disabled } = useForm(); const params = toJS(values.params); const [dataSourceName, collectionName] = parseCollectionName(values.collection); @@ -121,17 +121,19 @@ export function AssignedFieldsFormSchemaConfig(props) { - - - - - - - - - - - + + + + + + + + + + + + +