fix(api): search survives a down TMDB and errors name the upstream
This commit is contained in:
+12
-2
@@ -576,11 +576,21 @@ function searchMain(
|
||||
(hit): hit is LibrarySeriesHit => hit.kind === "series",
|
||||
);
|
||||
const inLibrary = new Set([...libraryMovies, ...librarySeries].map((title) => title.tmdb_id));
|
||||
// Issue #168: an unreachable TMDB degrades only its own group — the
|
||||
// operator sees the library half plus why TMDB is missing, and can tell
|
||||
// that apart from a clean "nothing found".
|
||||
const tmdbDown = response.tmdb_status === "unavailable";
|
||||
if (response.library.length === 0 && response.tmdb.length === 0) {
|
||||
setStatus("no matches in library or on tmdb");
|
||||
setStatus(
|
||||
tmdbDown ? "no matches in library — tmdb unavailable" : "no matches in library or on tmdb",
|
||||
);
|
||||
return;
|
||||
}
|
||||
setStatus(null);
|
||||
if (tmdbDown) {
|
||||
setStatus("tmdb unavailable — showing library matches only", "fault");
|
||||
} else {
|
||||
setStatus(null);
|
||||
}
|
||||
|
||||
if (response.library.length > 0) {
|
||||
refs.groups.library.section.hidden = false;
|
||||
|
||||
Reference in New Issue
Block a user