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

Regression in 0.14.3: Bad handling of redirects, page going back instead of redirecting #474

Closed
TPReal opened this issue Aug 28, 2024 · 1 comment

Comments

@TPReal
Copy link

TPReal commented Aug 28, 2024

Describe the bug

The handling of params-only paths added in 0.14.3 is broken. In some situations redirects caused by setSearchParams ends up on the previous page than the one it's started from, as if back was clicked.

Your Example Website or App

https://stackblitz.com/edit/tanstack-query-2qepsz?file=src%2Findex.tsx

Steps to Reproduce the Bug or Issue

You start on the /a page, click the link to go to /b, then the link to go back etc.
On solid-router 0.14.3 going from /a to /b seems not to work (this is visible on the first or on the second round).

Expected behavior

On solid-router 0.14.2 it work fine, going between the two pages. This is correct.

Screenshots or Videos

No response

Platform

  • OS: Windows
  • Browser: Chrome
  • Version: 127.0.6533.120

Additional context

The resolvedTo variable is set to resolvePath((queryOnly && (s = source().value) && s.split("?")[0]) || "", to) in this case. I don't understand the purpose of this expression, but the result is that it is set to the source, which is the previous page, at least in some situations. This seems to be causing the problems.

@ryansolid
Copy link
Member

Yeah it's because the source hasn't been updated yet (that happens at the end) and it is trying to navigate while in the middle of another navigation and reading the outdated value. Thanks for bringing this to my attention.

pirosiki197 added a commit to traPtitech/NeoShowcase that referenced this issue Sep 2, 2024
v0.14.3 has an issue about routing (solidjs/solid-router#474)
This should be fixed in v0.14.4
pirosiki197 added a commit to traPtitech/NeoShowcase that referenced this issue Sep 2, 2024
v0.14.3 has an issue about routing (solidjs/solid-router#474)
This should be fixed in v0.14.4
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

No branches or pull requests

2 participants