From a754bcedd80bf6cea5dbb8e4920aec6c5f82e937 Mon Sep 17 00:00:00 2001 From: Katherine Date: Fri, 5 Jul 2024 09:45:52 +0800 Subject: [PATCH] fix: external data source filterTargetKey undefined in filter action (#4815) * fix: external data source filterTargetKey undefined in filter action * fix: bug --- .../CollectionsManager/CollectionTitle.tsx | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/CollectionTitle.tsx b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/CollectionTitle.tsx index c84670b2ab..5677c863da 100644 --- a/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/CollectionTitle.tsx +++ b/packages/plugins/@nocobase/plugin-data-source-manager/src/client/component/CollectionsManager/CollectionTitle.tsx @@ -8,15 +8,20 @@ */ import { ExclamationCircleTwoTone } from '@ant-design/icons'; -import { useCollectionRecordData, useCompile } from '@nocobase/client'; +import { useCollectionRecordData, useCompile, Input } from '@nocobase/client'; +import { useField } from '@formily/react'; import { Popover } from 'antd'; import React from 'react'; import { SetFilterTargetKey } from './SetFilterTargetKey'; -export const CollectionTitle = () => { - const record = useCollectionRecordData(); +export const CollectionTitle = (props) => { + const record = useCollectionRecordData() || {}; const compile = useCompile(); - if (record.filterTargetKey) { + const field = useField(); + if (field.editable) { + return ; + } + if (record?.filterTargetKey) { return compile(record.title); } return (