Deep-review round 1 over main..improvement/watch-background-audio. BootGate - The tab's account pin is corrected to the account the server answered as. The server honours the pin only for an account still signed in to this browser and otherwise answers as the default, so a tab pinned to an account signed out in another tab ran as the default on the server while reading and writing the gone account's local state. - A mounted tab whose identity changes (its session ended, or the case above) reloads instead of rebuilding the tree in place, like every account switch; that also drops the previous account's query cache. The account key on the tree goes: the readyFor gate already unmounted it on every change. - An unanswered setup probe shows the error with Retry, like an unanswered account probe, instead of the signed-out landing to a signed-in user. - Comments: /api/me never 401s; the ended-session path is identity → nobody. Loading states - LoadingState's reveal delay is one clock across loading states that hand over to each other (boot screen → page-chunk fallback → the page's own fetching state), instead of a CSS delay restarted by each, which blanked a visible spinner for another 300 ms at every hand-off. BootScreen is now the shared loading visual, full screen, counting from navigation start. Plex shared link - Persists only the dimensions the link carries again. Writing the default filters for an omitted `pf` created the stored-filters key, which is what tells SavedViewsProvider the account picked filters, so the account's default Plex saved view was never applied again. Watch page - The Repeat toggle uses the shared pressed-pill paint (a solid fill when on) instead of Button variants that differ only in colour, and its flag goes through storage.ts readJSON/writeJSON. - The actions wrap under the title when the row is too narrow, instead of squeezing the title into a column a word wide on a phone; the title breaks long words. Comments that still justified code by the removed adopt effects (usePref, PrefsProvider, FeedViewProvider) are rewritten against the seed-once model. Tests: BootGate error/retry for both probes, setup mode, a failed background refetch keeping the app, the pin correction and the reload on an identity change; the shared reveal clock; the Plex link persist; the audio signature actually moved off version 4; a video download (av and v) still remuxed to an mp4. Each mutation-checked RED for its own reason.
46 lines
1.6 KiB
TypeScript
46 lines
1.6 KiB
TypeScript
// @vitest-environment jsdom
|
|
//
|
|
// A shared Plex link is persisted to the account, but only the dimensions it CARRIES. The bug it
|
|
// replaced: a link with only a scope also wrote the (empty) default filters, and a stored Plex filters
|
|
// value at all is what tells SavedViewsProvider the account has picked filters — so the account's
|
|
// default saved view was never applied again.
|
|
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
import { render, cleanup } from "@testing-library/react";
|
|
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
|
|
import { NavigationProvider } from "./NavigationProvider";
|
|
import { PlexProvider } from "./PlexProvider";
|
|
import { ACTIVE_ACCOUNT_KEY } from "../lib/activeAccount";
|
|
|
|
function mount() {
|
|
render(
|
|
<QueryClientProvider client={new QueryClient()}>
|
|
<NavigationProvider>
|
|
<PlexProvider>
|
|
<div />
|
|
</PlexProvider>
|
|
</NavigationProvider>
|
|
</QueryClientProvider>,
|
|
);
|
|
}
|
|
|
|
beforeEach(() => {
|
|
localStorage.clear();
|
|
sessionStorage.setItem(ACTIVE_ACCOUNT_KEY, "5");
|
|
});
|
|
afterEach(() => {
|
|
cleanup();
|
|
window.history.replaceState(null, "", "/");
|
|
});
|
|
|
|
describe("PlexProvider shared link", () => {
|
|
it("persists the scope a link carries and leaves the dimensions it omits unwritten", () => {
|
|
window.history.replaceState(null, "", "/?page=plex&pscope=movie");
|
|
mount();
|
|
|
|
expect(localStorage.getItem("siftlode.plexLibrary.5")).toBe("movie");
|
|
expect(localStorage.getItem("siftlode.plexFilters.5")).toBeNull();
|
|
expect(localStorage.getItem("siftlode.plexSort.5")).toBeNull();
|
|
expect(localStorage.getItem("siftlode.plexShow.5")).toBeNull();
|
|
});
|
|
});
|