Skip to content

fix(web): a player's return link replaces the page it left instead of pushing it - #1675

Open
kaziqta wants to merge 1 commit into
Viren070:mainfrom
kaziqta:fix/return-link-history
Open

kaziqta wants to merge 1 commit into
Viren070:mainfrom
kaziqta:fix/return-link-history

Conversation

@kaziqta

@kaziqta kaziqta commented Oct 29, 2026 •

Copy link
Copy Markdown

Coming back from an external player (VLC, MX Player, mpv, Vimu or another app) on Android, the first press of Back did nothing visible and the second did what the first should have.

The app hands the player's return link (aiostreams://return/item/…?played=…&source=…) to the page, which navigated to it with a push. The item page was already the current entry, so the history held it twice: once as the user left it, once as the return. useExternalReturn then stripped the marks with replaceState, which left two identical entries. Back moved from one to the other.

The route handler now replaces the entry when the link names the page already shown (path compared without its query, so an episode's ?season=…&episode=… still matches its series page) and pushes otherwise, so a link that opens a different page, or the app from cold, keeps its history as before.

Tested: pnpm -F @aiostreams/web typecheck, lint and prettier pass. Reasoned from the code on a Homatics Box R 4K Plus (Android TV 14) where the double Back was reproduced with Vimu; the same path serves every link player.

Summary by CodeRabbit

  • Bug Fixes
    • Improved navigation for app links with the same route but different query strings, avoiding an extra browser history entry.

@coderabbitai

coderabbitai Bot commented Oct 29, 2026 •

Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 62ae17f3-6942-4125-8883-0e4c3712c87e
Commits

Reviewing files that changed from the base of the PR and between f959e42 and 5ec211a.

Files selected for processing: 1
  • packages/web/src/app.tsx

Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 7 remain after this review.

Walkthrough

Route app links now replace the current history entry when the current hash route and destination have the same path after query strings are removed. Otherwise, navigation pushes the destination. Non-route app-link handling is unchanged.

Changes

Route Link Navigation

Layer / File(s) Summary
Choose route history action
packages/web/src/app.tsx
Route app links replace the current history entry when the paths match without query strings. Otherwise, they push navigation. Non-route app-link handling is unchanged.

Priority: Low

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Possibly related PRs

  • Viren070/AIOStreams#1674: Adds Vimu as an Android external player and generates a return URL used in the external-player route flow.

Suggested reviewers: viren070

Merge Risk: Minimal · up to 5ec21

No actionable merge-blocking risk is identified in the route-history change. It appears mergeable subject to normal checks.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly describes the main change: return links replace the current page instead of adding a duplicate history entry.
Docstring Coverage Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 1 files.

Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit hops along the route,
And checks the query on the way.
Same path? Replace the history.
New path? Push it into play.
Then nibble clover by the bay.

Comment @coderabbitai help to get the list of available commands.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant