mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 14:27:02 +08:00
fix(nbstore): adjust indexer logic (#11355)
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { DocsSearchService } from '@affine/core/modules/docs-search';
|
||||
import { WorkspaceService } from '@affine/core/modules/workspace';
|
||||
import { LiveData, useLiveData, useService } from '@toeverything/infra';
|
||||
import { type ReactNode, useEffect, useMemo } from 'react';
|
||||
|
||||
@@ -14,6 +15,7 @@ const PagePreviewInner = ({
|
||||
fallback,
|
||||
}: PagePreviewProps) => {
|
||||
const docSummary = useService(DocsSearchService);
|
||||
const workspaceService = useService(WorkspaceService);
|
||||
const summary = useLiveData(
|
||||
useMemo(
|
||||
() => LiveData.from(docSummary.watchDocSummary(pageId), null),
|
||||
@@ -26,6 +28,11 @@ const PagePreviewInner = ({
|
||||
return undo;
|
||||
}, [docSummary, pageId]);
|
||||
|
||||
useEffect(() => {
|
||||
const undo = workspaceService.workspace.engine.doc.addPriority(pageId, 10);
|
||||
return undo;
|
||||
}, [workspaceService, pageId]);
|
||||
|
||||
const res =
|
||||
summary === null ? fallback : summary === '' ? emptyFallback : summary;
|
||||
return res;
|
||||
|
||||
Reference in New Issue
Block a user