Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(core): dont show config properties in peek view (#8594)

pengx172fc27f41f0a6
diff --git a/packages/frontend/core/src/components/doc-properties/table.tsx b/packages/frontend/core/src/components/doc-properties/table.tsx
index ac768c7484..16fe542a2c 100644
--- a/packages/frontend/core/src/components/doc-properties/table.tsx
+++ b/packages/frontend/core/src/components/doc-properties/table.tsx
@@ -23,6 +23,7 @@ import {
DocsService,
useLiveData,
useService,
+ useServiceOptional,
} from '@toeverything/infra';
import clsx from 'clsx';
import type React from 'react';
@@ -245,7 +246,7 @@ export const DocPropertiesTableBody = forwardRef<
const t = useI18n();
const docsService = useService(DocsService);
const workbenchService = useService(WorkbenchService);
- const viewService = useService(ViewService);
+ const viewService = useServiceOptional(ViewService);
const properties = useLiveData(docsService.propertyList.sortedProperties$);
const [propertyCollapsed, setPropertyCollapsed] = useState(true);
@@ -312,20 +313,22 @@ export const DocPropertiesTableBody = forwardRef<
{t['com.affine.page-properties.add-property']()}
</Button>
</Menu>
- <Button
- variant="plain"
- prefix={<PropertyIcon />}
- className={clsx(
- styles.propertyActionButton,
- styles.propertyConfigButton
- )}
- onClick={() => {
- viewService.view.activeSidebarTab('properties');
- workbenchService.workbench.openSidebar();
- }}
- >
- {t['com.affine.page-properties.config-properties']()}
- </Button>
+ {viewService ? (
+ <Button
+ variant="plain"
+ prefix={<PropertyIcon />}
+ className={clsx(
+ styles.propertyActionButton,
+ styles.propertyConfigButton
+ )}
+ onClick={() => {
+ viewService.view.activeSidebarTab('properties');
+ workbenchService.workbench.openSidebar();
+ }}
+ >
+ {t['com.affine.page-properties.config-properties']()}
+ </Button>
+ ) : null}
</div>
</PropertyCollapsibleContent>
</PropertyCollapsibleSection>