-
-
Notifications
You must be signed in to change notification settings - Fork 586
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 issue with redirects in server fns creating multiple Location headers #550
Conversation
On the server side, we can use is_success or is_redirection to check the status. |
I did not know those existed! But I don't think a number of 3xx error codes are valid responses for our Form component |
@gbj You'll probably want to take a look at this. I believe I've fixed the behavior in a quite kludgy way. I've changed it to check for that, and redirect based on the url() field in the 200 response. But to do that I had to import the url crate(which looked like it was disabled for hydration), to convert the absolute path into a relative one for navigate() Also, navigating this way produces a warning and a panic in the leptos reactive code in the firefox console, something about updating non-existent signals. But hey, it redirects, so...... |
Ah okay, great! Good work figuring this out. By the way you seem to have committed some Nix-related files inadvertently (
There's already a
|
Because headers from
ResponseOptions
were set before the default referral on form submission, you could useredirect()
in your server fn, and the default referral would add another Location header, if it was a form submission. Then everything would blow up.