Closed brandonpittman closed 1 month ago
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?
@wmertens
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).
https://github.com/user-attachments/assets/eacb88b4-f272-49b4-8317-e7c3b2f4d57a
@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
https://github.com/user-attachments/assets/11bff795-3abf-4121-bbde-6c763f10184c
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