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.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
fix(core): open page info modal error (#8396)
EYHN4295f5e7c152
diff --git a/packages/frontend/core/src/components/affine/page-properties/info-modal/info-modal.tsx b/packages/frontend/core/src/components/affine/page-properties/info-modal/info-modal.tsxindex b613a2e5db..1f52f51c0e 100644--- a/packages/frontend/core/src/components/affine/page-properties/info-modal/info-modal.tsx+++ b/packages/frontend/core/src/components/affine/page-properties/info-modal/info-modal.tsx@@ -7,13 +7,24 @@ import {import { DocInfoService } from '@affine/core/modules/doc-info';import { DocsSearchService } from '@affine/core/modules/docs-search';import { useI18n } from '@affine/i18n';+import type { Doc } from '@toeverything/infra';import {+ DocsService,+ FrameworkScope,LiveData,useLiveData,useService,useServices,} from '@toeverything/infra';-import { Suspense, useCallback, useContext, useMemo, useRef } from 'react';+import {+ Suspense,+ useCallback,+ useContext,+ useEffect,+ useMemo,+ useRef,+ useState,+} from 'react';import { BlocksuiteHeaderTitle } from '../../../blocksuite/block-suite-header/title';import { managerContext } from '../common';@@ -31,10 +42,26 @@ import { TimeRow } from './time-row';export const InfoModal = () => {const modal = useService(DocInfoService).modal;const docId = useLiveData(modal.docId$);+ const docsService = useService(DocsService);++ const [doc, setDoc] = useState<Doc | null>(null);+ useEffect(() => {+ if (!docId) return;+ const docRef = docsService.open(docId);+ setDoc(docRef.doc);+ return () => {+ docRef.release();+ setDoc(null);+ };+ }, [docId, docsService]);- if (!docId) return null;+ if (!doc || !docId) return null;- return <InfoModalOpened docId={docId} />;+ return (+ <FrameworkScope scope={doc.scope}>+ <InfoModalOpened docId={docId} />+ </FrameworkScope>+ );};const InfoModalOpened = ({ docId }: { docId: string }) => {