From b8e597fa1dcb3cecf76e184571eb4447a7910b0e Mon Sep 17 00:00:00 2001 From: DarkSky Date: Wed, 7 Jan 2026 10:42:51 +0800 Subject: [PATCH] fix: hide search local label if need --- .../core/src/modules/quicksearch/impls/docs.ts | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/frontend/core/src/modules/quicksearch/impls/docs.ts b/packages/frontend/core/src/modules/quicksearch/impls/docs.ts index 8a851bf44a..c94ce2035f 100644 --- a/packages/frontend/core/src/modules/quicksearch/impls/docs.ts +++ b/packages/frontend/core/src/modules/quicksearch/impls/docs.ts @@ -105,7 +105,7 @@ export class DocsQuickSearchSession switchMap((query: string) => { let out; if (!query) { - out = of([] as QuickSearchItem<'docs', DocsPayload>[]); + out = of({ items: [], useLocalLabel: false }); } else { const preferRemote = !this.searchLocally && this.isSupportServerIndexer(); @@ -143,8 +143,8 @@ export class DocsQuickSearchSession ); out = search$.pipe( - map(({ docs, useLocalLabel }) => - docs + map(({ docs, useLocalLabel }) => { + const items = docs .map(doc => { const docRecord = this.docsService.list.doc$(doc.docId).value; return [doc, docRecord] as const; @@ -177,16 +177,18 @@ export class DocsQuickSearchSession timestamp: updatedDate, payload: doc, } as QuickSearchItem<'docs', DocsPayload>; - }) - ) + }); + return { items, useLocalLabel }; + }) ); } return out.pipe( - tap((items: QuickSearchItem<'docs', DocsPayload>[]) => { + tap(({ items, useLocalLabel }) => { this.items$.next( this.isSupportServerIndexer() && !this.searchLocally && - !this.isEnableBatterySaveMode() + !this.isEnableBatterySaveMode() && + !useLocalLabel ? [...items, this.searchLocallyItem] : items );