mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 04:48:53 +00:00
fix(core): hidden not supported property in display menu (#12445)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## 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. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -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 (
|
||||
|
||||
@@ -113,7 +113,7 @@ export const ListViewProperties = ({ docId }: { docId: string }) => {
|
||||
if (!displayKey || !displayProperties?.includes(displayKey)) {
|
||||
return null;
|
||||
}
|
||||
if (systemProperty) {
|
||||
if (systemProperty && systemProperty.showInDocList) {
|
||||
return (
|
||||
<SystemPropertyRenderer
|
||||
doc={doc}
|
||||
@@ -121,7 +121,10 @@ export const ListViewProperties = ({ docId }: { docId: string }) => {
|
||||
key={systemProperty.type}
|
||||
/>
|
||||
);
|
||||
} else if (workspaceProperty) {
|
||||
} else if (
|
||||
workspaceProperty &&
|
||||
WorkspacePropertyTypes[workspaceProperty.type]?.showInDocList
|
||||
) {
|
||||
return (
|
||||
<WorkspacePropertyRenderer
|
||||
key={workspaceProperty.id}
|
||||
|
||||
Reference in New Issue
Block a user