mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-17 06:16:59 +08:00
fix: hide search local label if need
This commit is contained in:
@@ -105,7 +105,7 @@ export class DocsQuickSearchSession
|
|||||||
switchMap((query: string) => {
|
switchMap((query: string) => {
|
||||||
let out;
|
let out;
|
||||||
if (!query) {
|
if (!query) {
|
||||||
out = of([] as QuickSearchItem<'docs', DocsPayload>[]);
|
out = of({ items: [], useLocalLabel: false });
|
||||||
} else {
|
} else {
|
||||||
const preferRemote =
|
const preferRemote =
|
||||||
!this.searchLocally && this.isSupportServerIndexer();
|
!this.searchLocally && this.isSupportServerIndexer();
|
||||||
@@ -143,8 +143,8 @@ export class DocsQuickSearchSession
|
|||||||
);
|
);
|
||||||
|
|
||||||
out = search$.pipe(
|
out = search$.pipe(
|
||||||
map(({ docs, useLocalLabel }) =>
|
map(({ docs, useLocalLabel }) => {
|
||||||
docs
|
const items = docs
|
||||||
.map(doc => {
|
.map(doc => {
|
||||||
const docRecord = this.docsService.list.doc$(doc.docId).value;
|
const docRecord = this.docsService.list.doc$(doc.docId).value;
|
||||||
return [doc, docRecord] as const;
|
return [doc, docRecord] as const;
|
||||||
@@ -177,16 +177,18 @@ export class DocsQuickSearchSession
|
|||||||
timestamp: updatedDate,
|
timestamp: updatedDate,
|
||||||
payload: doc,
|
payload: doc,
|
||||||
} as QuickSearchItem<'docs', DocsPayload>;
|
} as QuickSearchItem<'docs', DocsPayload>;
|
||||||
})
|
});
|
||||||
)
|
return { items, useLocalLabel };
|
||||||
|
})
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return out.pipe(
|
return out.pipe(
|
||||||
tap((items: QuickSearchItem<'docs', DocsPayload>[]) => {
|
tap(({ items, useLocalLabel }) => {
|
||||||
this.items$.next(
|
this.items$.next(
|
||||||
this.isSupportServerIndexer() &&
|
this.isSupportServerIndexer() &&
|
||||||
!this.searchLocally &&
|
!this.searchLocally &&
|
||||||
!this.isEnableBatterySaveMode()
|
!this.isEnableBatterySaveMode() &&
|
||||||
|
!useLocalLabel
|
||||||
? [...items, this.searchLocallyItem]
|
? [...items, this.searchLocallyItem]
|
||||||
: items
|
: items
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user