Skip to content

Web: a session stopped after a refused replan doesn't refresh the page the viewer returns to #4428

Closed

Description

@Quick104

Leaving the web player shortly after it refuses a quality or output change can leave the series page showing old watch state until a reload.

#4423 has the player refresh the playback surfaces once its unmount stop settles (onSessionStopped). That covers the usual exit. There is one more path. When a replan for a changed output is refused, retireActiveSession (web/src/player/hooks/usePlaybackSession.ts) starts stopping the session and clears sessionIdRef right away. If the viewer then chooses Go back on the error screen before that stop lands, the unmount calls stopOnPageExit(null). That returns early, so the host is never told when the retired session's stop lands. The page the viewer returns to can read before that stop writes watch history or marks the later episodes of a multi-episode file watched.

This trigger is much narrower than the race #4423 fixes. It needs a refused replan followed by an exit within the stop's round trip. Found in review of #4423. Not reproduced live; this comes from reading the code.

Expected

The page the viewer returns to reflects every stop the player sent, including one for a retired session.

Possible fix

Have retireActiveSession keep its stop promise. When the player unmounts while that stop is still pending, call config.onSessionStopped once it settles, the same way stopOnPageExit does. A test like the one #4423 added in usePlaybackSession.test.ts, with the retirement stop held open across the unmount, would cover it.

Activity

  1. added
    bug
    impact: polish
    priority: P2
    triaged
    on Nov 17, 2026
  2. Rhainland commented on Nov 18, 2026

    @Rhainland
    Contributor

    Reproduced on origin/main at e8de1117e: I played an episode in the web player to about 82 s, made the display drop HDR so the player asked for an output change, answered it with a terminal refusal, held the session stop for 4 s and chose Go Back. The episode page never read its catalog queries again after the stop landed, so it showed no progress while the server had the position saved.

    Cause: retireActiveSession dropped its stop promise and cleared the session ID, so the unmount's stopOnPageExit(null) returned early and nothing told the page when the retired session's stop landed.

    Fix in #4508: the page you go back to now refreshes when a retired session's stop lands, in the same way #4423 handles the exit stop. Checked on a local build of the fix with the same steps at desktop and phone widths: the page re-reads its item, season and episode queries within milliseconds of the stop and shows the progress bar. A normal exit still refreshes once. The existing refused-output test in usePlaybackSession.test.ts now holds the stop across the unmount and checks that the host is told only after it lands.

    AI disclosure: reproduced and fixed by Claude Code (claude-opus-5-5) at the maintainer's direction.

  3. added a commit that references this issue on Nov 18, 2026
    a79cb3b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugimpact: polishpriority: P2triaged

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions