Skip to content

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

@TPReal

Description

@TPReal

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions