fix(playlists): a failed background refetch keeps the list on screen, and the player outlives every branch

Deep-review round 3 of bug hunt 2026-09.

- The detail's error branch applies only when there is nothing to show (`isError && <no data>`, the
  QueryState convention): one failed refetch — on focus, after a move or a removal — replaced a
  loaded list with "couldn't load". The error line is announced (role=alert).
- Tests for the two branches of "the player survives a change of selection" that round 2 left
  untested (a list that fails to load, no selection).
This commit is contained in:
2026-09-11 18:05:19 +02:00
parent 1cfe6a7f59
commit 76b5f7c93e
2 changed files with 43 additions and 3 deletions
+5 -3
View File
@@ -813,11 +813,13 @@ export default function Playlists() {
);
}
// The page used to render "Loading…" forever when the detail query failed — an error read as a
// slow network that never arrived.
if (detailQuery.isError) {
// slow network that never arrived. Only with nothing to show, though (the `isError && <no data>`
// convention, see ui/QueryState): a background refetch that failed — on focus, after a move or a
// removal — replaced a list that was on screen with this message.
if (detailQuery.isError && !detail) {
return (
<>
<div className="text-sm p-4 flex flex-col items-start gap-3">
<div role="alert" className="text-sm p-4 flex flex-col items-start gap-3">
<span className="inline-flex items-center gap-2 text-muted">
<AlertTriangle className="w-4 h-4 text-danger" />
{t("playlists.loadFailed")}