From eca35ded2f8c845d112f12856637f59ac7443f3d Mon Sep 17 00:00:00 2001 From: EYHN Date: Tue, 12 Mar 2024 05:09:14 +0000 Subject: [PATCH] fix(core): fix page priority load (#6072) When refactoring, I planned to put the logic of loading current pages priority in `PageManager.open`, but I forgot, so the current page will not be loaded priority. But currently `PageManager.open` has been used in many places, but only one priority page can be set, so the logic of setting the priority page is still placed in the detail page. --- .../core/src/pages/workspace/detail-page/detail-page.tsx | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx b/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx index 149f4c1078..497a4c984e 100644 --- a/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx +++ b/packages/frontend/core/src/pages/workspace/detail-page/detail-page.tsx @@ -255,6 +255,7 @@ const DetailPageImpl = memo(function DetailPageImpl() { }); export const DetailPage = ({ pageId }: { pageId: string }): ReactElement => { + const currentWorkspace = useService(Workspace); const pageRecordList = useService(PageRecordList); const pageListReady = useLiveData(pageRecordList.isReady); @@ -281,6 +282,11 @@ export const DetailPage = ({ pageId }: { pageId: string }): ReactElement => { }; }, [pageManager, pageRecord]); + // set sync engine priority target + useEffect(() => { + currentWorkspace.setPriorityRule(id => id.endsWith(pageId)); + }, [currentWorkspace, pageId]); + const jumpOnce = useLiveData(pageRecord?.meta.map(meta => meta.jumpOnce)); useEffect(() => {