From 5897db6911ba9c750fa217c2c0f934f7a433430d Mon Sep 17 00:00:00 2001 From: EYHN Date: Thu, 22 May 2025 09:13:10 +0000 Subject: [PATCH] fix(core): hidden not supported property in display menu (#12445) ## Summary by CodeRabbit - **New Features** - Properties in the document list are now displayed only if they are explicitly marked to be shown, providing a more streamlined and relevant view. - **Bug Fixes** - Improved filtering ensures that only designated properties appear in the document list, preventing unintended properties from being shown. --- .../src/components/explorer/display-menu/properties.tsx | 8 +++++++- .../core/src/components/explorer/docs-view/properties.tsx | 7 +++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/packages/frontend/core/src/components/explorer/display-menu/properties.tsx b/packages/frontend/core/src/components/explorer/display-menu/properties.tsx index 26f6c0c53f..f4b307518f 100644 --- a/packages/frontend/core/src/components/explorer/display-menu/properties.tsx +++ b/packages/frontend/core/src/components/explorer/display-menu/properties.tsx @@ -5,6 +5,7 @@ import { useLiveData, useService } from '@toeverything/infra'; import { useCallback, useMemo } from 'react'; import { WorkspacePropertyName } from '../../properties'; +import { WorkspacePropertyTypes } from '../../workspace-property-types'; import { generateExplorerPropertyList } from '../properties'; import type { ExplorerDisplayPreference } from '../types'; import * as styles from './properties.css'; @@ -147,7 +148,12 @@ const PropertyRenderer = ({ : null; const isActive = activeKey && displayProperties.includes(activeKey); - if (!key) { + const showInDocList = + systemProperty?.showInDocList || + (workspaceProperty && + WorkspacePropertyTypes[workspaceProperty.type]?.showInDocList); + + if (!key || !showInDocList) { return null; } return ( diff --git a/packages/frontend/core/src/components/explorer/docs-view/properties.tsx b/packages/frontend/core/src/components/explorer/docs-view/properties.tsx index accf706f7f..5dc06a17c0 100644 --- a/packages/frontend/core/src/components/explorer/docs-view/properties.tsx +++ b/packages/frontend/core/src/components/explorer/docs-view/properties.tsx @@ -113,7 +113,7 @@ export const ListViewProperties = ({ docId }: { docId: string }) => { if (!displayKey || !displayProperties?.includes(displayKey)) { return null; } - if (systemProperty) { + if (systemProperty && systemProperty.showInDocList) { return ( { key={systemProperty.type} /> ); - } else if (workspaceProperty) { + } else if ( + workspaceProperty && + WorkspacePropertyTypes[workspaceProperty.type]?.showInDocList + ) { return (