-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[🐞] Qwik 1.9.0 holds onto searchParams when redirecting from a server action #6926
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
Comments
Seems related to this: But if this is what the team thinks should be the correct behavior, how can I drop the searchParams? |
@brandonpittman can you provide a repro so we're talking about the same things? I thought that change was to provide search parameters when calling actions? |
The Stackblitz link above shows this behavior: If you submit a form from a page with searchParams and redirect in the action, the page you get redirected to has the previous page’s searchParams even though the redirect was to a route with no searchParams. This only started with 1.9.0. Here's a recording showing the problem (includes audio). searchParams.issue.720.mov |
@wmertens Just for completeness, here's another Stackblitz (with recording) pinned at 1.8.0 where redirects don't hold onto the submitting page's searchParams. https://stackblitz.com/edit/github-cv95eb-7l9fik?file=package.json Screen.Recording.2024-10-01.at.3.36.23.PM.mov |
Pretty sure this is what broke things: |
Another problem is that if you redirect to a URL with searchParams, Qwik drops the params in the URL you try to redirect to. |
I created a PR. Can someone take a look at it, please? |
Which component is affected?
Qwik City (routing)
Describe the bug
Through 1.8.0, our app would successfully redirect from server actions to some URL like
/profile
from the front page of the app. The front page takes an?id=XXX
param to get some data and then after tapping a consent button, it runs an action, saves data to a cookie and throws a redirect.It used to drop the search params when redirecting. Since 1.9.0, it holds onto the search params.
Reproduction
https://stackblitz.com/edit/github-cv95eb?file=src%2Froutes%2Findex.tsx
Steps to reproduce
No response
System Info
Additional Information
No response
The text was updated successfully, but these errors were encountered: