mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-12 19:15:43 +03:00
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:
parent
3672366fea
commit
eca35ded2f
@ -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(() => {
|
||||
|
Loading…
Reference in New Issue
Block a user