Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(router): don't use replace on every route when going back #2464

Merged
merged 4 commits into from
Sep 18, 2024

Conversation

ToastKiste21
Copy link
Contributor

Related Issue: #2403

Summary
This merge request resolves a navigation issue where users were unable to traverse the entire navigation history using the back button in the application's sidebar. The problem stemmed from overriding the router.back method with router.replace, which disrupted the history stack and prevented Vue Router from accurately tracking the history length.

@jellyfin-bot
Copy link

jellyfin-bot commented Sep 17, 2024

Cloudflare Pages deployment

Latest commit a547e03
Status ✅ Deployed!
Preview URL https://dcdda864.jf-vue.pages.dev
Type 🔀 Preview

View build logs

Copy link
Member

@ferferga ferferga left a comment

Choose a reason for hiding this comment

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

Thank you very much for your willingness to fix this! However, this doesn't fix the issue:

  • This reintroduces the situation described in the comment: if you click on the link of the readme of this repo to load the hosted instance and then click in the back button, you will be redirected back to GitHub, while we want to hack all the back navigation inside the application (of course not in the browser's buttons, just in the app's).
  • There's a reason why Vue Router has its own back function and we should not be more "clever". I believe this approach kills history routing and resolve hooks from Vue Router.

In either case, an appropiate fix would be to do nothing or perform the back on the logic truthiness, and only replace with index on falsyness. Can you try that and test if it fits all the conditions stated above?

@ferferga ferferga changed the title fix(router): replace custom back method with window.history.back() to… fix(router): don't use replace on every route when going back Sep 18, 2024
Copy link
Member

@ferferga ferferga left a comment

Choose a reason for hiding this comment

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

This works perfectly now! Can you please reintroduce the deleted comment about the transition though?

Copy link

sonarcloud bot commented Sep 18, 2024

@ferferga ferferga merged commit ccb0754 into jellyfin:master Sep 18, 2024
16 of 19 checks passed
@ferferga
Copy link
Member

ferferga commented Sep 18, 2024

@ToastKiste21 Thank you very much for your contribution and finding that replace was the issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

3 participants