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.
This commit is contained in:
EYHN
2024-03-12 05:09:14 +00:00
parent 3672366fea
commit eca35ded2f

View File

@@ -255,6 +255,7 @@ const DetailPageImpl = memo(function DetailPageImpl() {
}); });
export const DetailPage = ({ pageId }: { pageId: string }): ReactElement => { export const DetailPage = ({ pageId }: { pageId: string }): ReactElement => {
const currentWorkspace = useService(Workspace);
const pageRecordList = useService(PageRecordList); const pageRecordList = useService(PageRecordList);
const pageListReady = useLiveData(pageRecordList.isReady); const pageListReady = useLiveData(pageRecordList.isReady);
@@ -281,6 +282,11 @@ export const DetailPage = ({ pageId }: { pageId: string }): ReactElement => {
}; };
}, [pageManager, pageRecord]); }, [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)); const jumpOnce = useLiveData(pageRecord?.meta.map(meta => meta.jumpOnce));
useEffect(() => { useEffect(() => {