fix(player): a related video played is tracked, and its list is honest about its state
A related video played in place is the player's item now: its title and its own watched / playlist / download controls, its progress checkpointed and resumed, marked watched at its end — and its end does not step the queue. Back returns to the opened video, where it was left. The related list: - its marks announce through the shared notice (the Notification Center finds them), join the host's player session (the feed refetches on close), and stay per write, so an earlier answer no longer undoes a later mark still on its way; - every host's state write patches the cached related lists, which are never refetched; - kept for the session (gcTime), a retry asks for the page that failed, a list read so far with nothing unseen says so, a refusal a retry cannot answer offers none, and the followed mark names itself on hover. Turned off on the instance (a limit of 0), the tab, the drawer button and the live-search buttons are left out. Keys: the player's keys and its focus reclaim defer to a layer above it (the drawer); going wide moves the drawer's list into the panel's tab; `j` goes on from the slot of a row removed inside the top layer; the help sheet lists the list keys over a layer that holds a list.
This commit is contained in:
@@ -495,6 +495,31 @@ describe("Home", () => {
|
||||
expect(screen.queryByText("Hero v1")).toBeNull();
|
||||
});
|
||||
|
||||
it("puts a mark into the player's related lists, which are never refetched", async () => {
|
||||
const { qc } = mountWithClient();
|
||||
await screen.findByText("Second thing");
|
||||
qc.setQueryData(qk.related("SRC", "topical"), {
|
||||
pages: [
|
||||
{
|
||||
items: [
|
||||
{ id: "v1", status: "new" },
|
||||
{ id: "v2", status: "new" },
|
||||
],
|
||||
has_more: false,
|
||||
next_cursor: null,
|
||||
},
|
||||
],
|
||||
pageParams: [null],
|
||||
});
|
||||
fireEvent.click(screen.getAllByTitle("card.markWatched")[0]!);
|
||||
await waitFor(() => {
|
||||
const cached = qc.getQueryData(qk.related("SRC", "topical")) as {
|
||||
pages: { items: { status: string }[] }[];
|
||||
};
|
||||
expect(cached.pages[0]!.items.some((v) => v.status === "watched")).toBe(true);
|
||||
});
|
||||
});
|
||||
|
||||
it("refreshes the payload the bookmark is read from", async () => {
|
||||
mount();
|
||||
await screen.findByText("Second thing");
|
||||
|
||||
@@ -14,6 +14,7 @@ import {
|
||||
Star,
|
||||
} from "lucide-react";
|
||||
import { qk } from "../../lib/queryKeys";
|
||||
import { patchRelated } from "../../lib/progressCache";
|
||||
import { plexLang } from "../../i18n";
|
||||
import {
|
||||
api,
|
||||
@@ -838,7 +839,11 @@ export default function Home() {
|
||||
// The feed avoids this because it would refetch ten infinite-query pages per click.
|
||||
void api
|
||||
.setState(id, status)
|
||||
.then(() => qc.invalidateQueries({ queryKey: qk.discover() }))
|
||||
.then(() => {
|
||||
// The player's related lists are never refetched: the mark goes into them.
|
||||
patchRelated(qc, id, { status });
|
||||
return qc.invalidateQueries({ queryKey: qk.discover() });
|
||||
})
|
||||
// Without this the rejection escapes unhandled and the click just does nothing — the
|
||||
// feed's equivalents both catch, and the reorder on this same page already does.
|
||||
// A WRITE key, not `home.error`: that string is the page's LOAD failure ("could not load
|
||||
|
||||
Reference in New Issue
Block a user