fix: review round 2 — Clear watch progress clears only the resume point, big view focus by the way it arrived, dialog name, reason tooltip, backfill locks

This commit is contained in:
2026-11-01 18:26:33 +01:00
parent b3402d158f
commit 8dd2f0c015
37 changed files with 457 additions and 243 deletions
+4 -4
View File
@@ -46,14 +46,14 @@ vi.mock("react-i18next", async (importOriginal) => {
const discover = vi.fn();
const discoverPick = vi.fn();
const videoRow = vi.fn();
const clearState = vi.fn((_id: string) => Promise.resolve());
const clearProgress = vi.fn((_id: string) => Promise.resolve());
vi.mock("../../lib/api", () => ({
api: {
discover: (...a: unknown[]) => discover(...a),
videoRow: (...a: unknown[]) => videoRow(...a),
discoverPick: (...a: unknown[]) => discoverPick(...a),
setState: () => Promise.resolve(),
clearState: (id: string) => clearState(id),
clearProgress: (id: string) => clearProgress(id),
watchLaterAdd: () => Promise.resolve(),
watchLaterRemove: () => Promise.resolve(),
downloadIndex: () => Promise.resolve({}), // the cards' download buttons read it
@@ -816,11 +816,11 @@ describe("Home", () => {
fireEvent.click((await screen.findAllByRole("button", { name: "card.menu.more" }))[0]!);
const reset = screen
.getAllByRole("menuitem", { hidden: true })
.find((b) => b.textContent === "card.resetState");
.find((b) => b.textContent === "card.clearProgress");
expect(reset).toBeTruthy();
const asked = discover.mock.calls.length;
fireEvent.click(reset!);
await waitFor(() => expect(clearState).toHaveBeenCalledWith("v1"));
await waitFor(() => expect(clearProgress).toHaveBeenCalledWith("v1"));
await waitFor(() => expect(discover.mock.calls.length).toBeGreaterThan(asked));
});
+6 -6
View File
@@ -53,7 +53,7 @@ import { LoadingState, StateMessage } from "../../components/ui/QueryState";
import VideoCard, { VideoHoverActions } from "../../features/video/VideoCard";
import { useVideoActions } from "../../features/video/useVideoActions";
import {
resetVideoState,
clearVideoProgress,
writeVideoState,
writeWatchLater,
} from "../../features/video/videoWrites";
@@ -161,14 +161,14 @@ function useHomeCardMenu({
// A video tile's own action list, the same one the feed's menu shows; the rail keeps its
// Play row (it resolves `next`) and its shelf rows around it.
const qc = useQueryClient();
// Back to fresh: what the rails answer changes with it (a reset video leaves Continue watching),
// What the rails answer changes with it (a video with no resume point leaves Continue watching),
// so Home asks again, as its marks do.
const onResetState = (id: string) => {
void resetVideoState(qc, id)
const onClearProgress = (id: string) => {
void clearVideoProgress(qc, id)
.then(() => qc.invalidateQueries({ queryKey: qk.discover() }))
.catch((e: unknown) => notifyActionError(e, msg("errors.writeFailed.videoReset")));
.catch((e: unknown) => notifyActionError(e, msg("errors.writeFailed.videoProgress")));
};
const videoActions = useVideoActions({ onState, onToggleSave, onResetState }, menu.open);
const videoActions = useVideoActions({ onState, onToggleSave, onClearProgress }, menu.open);
// A Plex tile's, likewise (its "Media info" row goes where the tile's `onInfo` does).
const plexActions = usePlexCardActions(
{