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:
@@ -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")}
|
||||
|
||||
Reference in New Issue
Block a user