fix(portals): a recreated series page never reuses a page token

The token carries a module-wide instance number next to the visit
counter, so a page that replaced a destroyed one cannot collide with the
launches that page left behind.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Fable 5.1 committed 2026-10-03 15:18:09 +02:00
1 parent 3cdf1bd3ea
commit 1bb03d883c
1 file changed
+6 -1
@@ -66,6 +66,9 @@ interface SerialDetailsPlaybackBindings {
* serial details view: inline playback state, per-episode playback
* positions, external-player session tracking, and playback orchestration.
*/
/** Page instances created so far: a recreated page must not reuse a token. */
let pageInstances = 0;
@Injectable()
export class SerialDetailsPlaybackService {
private readonly route = inject(ActivatedRoute);
@@ -405,6 +408,8 @@ export class SerialDetailsPlaybackService {
isEpisodeLaunchPending(this.launchOwner())
);
/** Distinguishes this page instance from one that replaced it. */
private readonly pageInstance = ++pageInstances;
/** Bumped for every series the page shows: a return to the same series is a new visit. */
private pageGeneration = 0;
@@ -414,7 +419,7 @@ export class SerialDetailsPlaybackService {
* started, not after leaving and coming back.
*/
pageToken(): string {
return `${this.launchOwner()}#${this.pageGeneration}`;
return `${this.launchOwner()}#${this.pageInstance}.${this.pageGeneration}`;
}
/** `playlist:series` of the page, null once it is gone or shows another series. */