mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-21 16:26:58 +08: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 { useCallback, useMemo } from 'react';
|
||||||
|
|
||||||
import { WorkspacePropertyName } from '../../properties';
|
import { WorkspacePropertyName } from '../../properties';
|
||||||
|
import { WorkspacePropertyTypes } from '../../workspace-property-types';
|
||||||
import { generateExplorerPropertyList } from '../properties';
|
import { generateExplorerPropertyList } from '../properties';
|
||||||
import type { ExplorerDisplayPreference } from '../types';
|
import type { ExplorerDisplayPreference } from '../types';
|
||||||
import * as styles from './properties.css';
|
import * as styles from './properties.css';
|
||||||
@@ -147,7 +148,12 @@ const PropertyRenderer = ({
|
|||||||
: null;
|
: null;
|
||||||
const isActive = activeKey && displayProperties.includes(activeKey);
|
const isActive = activeKey && displayProperties.includes(activeKey);
|
||||||
|
|
||||||
if (!key) {
|
const showInDocList =
|
||||||
|
systemProperty?.showInDocList ||
|
||||||
|
(workspaceProperty &&
|
||||||
|
WorkspacePropertyTypes[workspaceProperty.type]?.showInDocList);
|
||||||
|
|
||||||
|
if (!key || !showInDocList) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
|
|||||||
@@ -113,7 +113,7 @@ export const ListViewProperties = ({ docId }: { docId: string }) => {
|
|||||||
if (!displayKey || !displayProperties?.includes(displayKey)) {
|
if (!displayKey || !displayProperties?.includes(displayKey)) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
if (systemProperty) {
|
if (systemProperty && systemProperty.showInDocList) {
|
||||||
return (
|
return (
|
||||||
<SystemPropertyRenderer
|
<SystemPropertyRenderer
|
||||||
doc={doc}
|
doc={doc}
|
||||||
@@ -121,7 +121,10 @@ export const ListViewProperties = ({ docId }: { docId: string }) => {
|
|||||||
key={systemProperty.type}
|
key={systemProperty.type}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else if (workspaceProperty) {
|
} else if (
|
||||||
|
workspaceProperty &&
|
||||||
|
WorkspacePropertyTypes[workspaceProperty.type]?.showInDocList
|
||||||
|
) {
|
||||||
return (
|
return (
|
||||||
<WorkspacePropertyRenderer
|
<WorkspacePropertyRenderer
|
||||||
key={workspaceProperty.id}
|
key={workspaceProperty.id}
|
||||||
|
|||||||
Reference in New Issue
Block a user