mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 02:01:42 +03:00
fix: current page atom (#4515)
This commit is contained in:
parent
1b6cd70247
commit
a633fb6dea
@ -60,6 +60,6 @@ export declare const pushLayoutAtom: WritableAtom<
|
||||
void
|
||||
>;
|
||||
export declare const deleteLayoutAtom: WritableAtom<null, [string], void>;
|
||||
export declare const currentPageAtom: Atom<Promise<Page>>;
|
||||
export declare const currentPageIdAtom: Atom<string | null>;
|
||||
export declare const currentWorkspaceAtom: Atom<Promise<Workspace>>;
|
||||
export declare const rootStore: ReturnType<typeof getDefaultStore>;
|
||||
|
@ -1,5 +1,6 @@
|
||||
import {
|
||||
currentPageAtom,
|
||||
currentPageIdAtom,
|
||||
currentWorkspaceAtom,
|
||||
deleteLayoutAtom,
|
||||
pushLayoutAtom,
|
||||
} from '@affine/sdk/entry';
|
||||
@ -15,7 +16,11 @@ import { createRoot } from 'react-dom/client';
|
||||
|
||||
const Outline = () => {
|
||||
const tocPanelRef = useRef<TOCNotesPanel | null>(null);
|
||||
const currentPage = useAtomValue(currentPageAtom);
|
||||
const currentPageId = useAtomValue(currentPageIdAtom);
|
||||
assertExists(currentPageId, 'current page id');
|
||||
const currentWorkspace = useAtomValue(currentWorkspaceAtom);
|
||||
const currentPage = currentWorkspace.getPage(currentPageId);
|
||||
assertExists(currentPage, 'current page');
|
||||
|
||||
if (!tocPanelRef.current) {
|
||||
tocPanelRef.current = new TOCNotesPanel();
|
||||
|
Loading…
Reference in New Issue
Block a user