Skip to content

Fix incorrect redirect after deleting an item from details page#8159

Open
robert-md-or wants to merge 6 commits into
jellyfin:masterfrom
robert-md-or:fix/incorrect-redirect-after-delete-v2
Open

Fix incorrect redirect after deleting an item from details page#8159
robert-md-or wants to merge 6 commits into
jellyfin:masterfrom
robert-md-or:fix/incorrect-redirect-after-delete-v2

Conversation

@robert-md-or

Copy link
Copy Markdown

Changes

When deleting an item from the details page, use appRouter.back() to return to the previous page instead of navigating to the parent item, which was generating a legacy URL.

Issues

Fixes #8106

Code assistance

Used Claude AI for codebase navigation. Fix and testing are my own.

Before:
Screenshot 2026-07-04 at 12 31 42

After:
Screenshot 2026-07-04 at 12 52 14


  • I have read and followed the contributing guidelines.
  • I have tested these changes.
  • I have verified that this is not duplicating changes in an existing PR.
  • I have provided a substantive review of another web PR.

@robert-md-or
robert-md-or requested a review from a team as a code owner July 4, 2026 10:09

@reecertc reecertc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

appRouter.back() works when the item was opened from a library, but the previous page is not always a safe place to return to. The details page might have been opened from a bookmark, or the previous page might be an item that was also deleted.

Could we keep the existing parent/home navigation as a fallback when there is no safe page to return to? This would fix the redirect without leaving the user on a deleted item page.

@robert-md-or

Copy link
Copy Markdown
Author

Updated the fix to include a fallback navigation as suggested. Now uses appRouter.back() when history is available, falls back to parent item navigation, and goes home as last resort.

@robert-md-or
robert-md-or requested a review from reecertc July 13, 2026 10:14

@reecertc reecertc left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more issue: canGoBack() uses window.history.length, but opening the context menu and confirmation increases that value even after they close. This means a directly opened details page can still take the back branch instead of the new fallback, leaving the router stuck.

You can keep the fallback and just update canGoBack()

-return window.history.length > 1;
+return (window.history.state?.idx ?? 0) > 0;

Should be good to go after this 👍🏻

@robert-md-or

Copy link
Copy Markdown
Author

Updated canGoBack() to use window.history.state?.idx instead of window.history.length as suggested. Thanks for the catch!

@robert-md-or
robert-md-or requested a review from reecertc July 17, 2026 08:28
@sonarqubecloud

Copy link
Copy Markdown

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.

[v12] Incorrect redirect after deleting an item from details page

2 participants