Fix: frontend handle autocomplete failure gracefully (#4903)

This commit is contained in:
shamoon
2023-12-11 07:41:40 -08:00
committed by GitHub
parent 7b7a74d821
commit 7ecf7f704a
2 changed files with 24 additions and 2 deletions

View File

@@ -8,6 +8,7 @@ import {
map,
switchMap,
first,
catchError,
} from 'rxjs/operators'
import { PaperlessDocument } from 'src/app/data/paperless-document'
import { OpenDocumentsService } from 'src/app/services/open-documents.service'
@@ -166,7 +167,13 @@ export class AppFrameComponent
}
}),
switchMap((term) =>
term.length < 2 ? from([[]]) : this.searchService.autocomplete(term)
term.length < 2
? from([[]])
: this.searchService.autocomplete(term).pipe(
catchError(() => {
return from([[]])
})
)
)
)