From 79735a372b3975885bba56886378c25ac6fe433e Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Wed, 10 Jan 2024 17:00:44 +0800 Subject: [PATCH] fix: linkage rule only support action with context record (#3355) --- packages/core/client/src/block-provider/FormBlockProvider.tsx | 4 ++-- .../src/schema-component/antd/action/Action.Designer.tsx | 1 - .../plugin-action-print/src/client/PrintAction.Settings.tsx | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/block-provider/FormBlockProvider.tsx b/packages/core/client/src/block-provider/FormBlockProvider.tsx index 52006aed1e..76d59d0087 100644 --- a/packages/core/client/src/block-provider/FormBlockProvider.tsx +++ b/packages/core/client/src/block-provider/FormBlockProvider.tsx @@ -84,8 +84,8 @@ export const useFormBlockType = () => { }; export const useIsDetailBlock = () => { - const ctx = useActionContext(); - return !(ctx?.fieldSchema?.['x-acl-action'] === 'create' || ctx?.fieldSchema?.['x-action'] === 'create'); + const ctx = useFormBlockContext(); + return ctx.type === 'update'; }; export const FormBlockProvider = (props) => { diff --git a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx index d2f46daf85..33a9dddb6e 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.Designer.tsx @@ -663,7 +663,6 @@ export const actionSettingsItems: SchemaSettingOptions['items'] = [ name: 'linkageRules', Component: SchemaSettingsLinkageRules, useVisible() { - const fieldSchema = useFieldSchema(); const isAction = useLinkageAction(); const { linkageAction } = useSchemaToolbar(); return linkageAction || isAction; diff --git a/packages/plugins/@nocobase/plugin-action-print/src/client/PrintAction.Settings.tsx b/packages/plugins/@nocobase/plugin-action-print/src/client/PrintAction.Settings.tsx index 41eb82d821..182d6c7004 100644 --- a/packages/plugins/@nocobase/plugin-action-print/src/client/PrintAction.Settings.tsx +++ b/packages/plugins/@nocobase/plugin-action-print/src/client/PrintAction.Settings.tsx @@ -3,7 +3,6 @@ import { ActionDesigner, useSchemaToolbar, SchemaSettingsLinkageRules, - useLinkageAction, useCollection, } from '@nocobase/client';