fix: hide search local label if need

This commit is contained in:
DarkSky
2026-01-07 10:42:51 +08:00
parent cf98afb32e
commit b8e597fa1d

View File

@@ -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
);