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
Form submit clears $page.state while shallow routing #405
Comments
If you can make a MRE here or in a repo, I'll take a closer look. Haven't tested it much with shallow routing. |
thanks for the quick reply! turns out, that if I build a simple example. everything works fine. Through some more testing I figured out that the load functions in +page.ts and/or +layout.ts are the trouble makers. As soon as I have a load function in the mix that returns data, the state is reset after the submit here is the repo: https://github.com/suicide/superforms-examples if you comment the load function out, everything works fine But I guess it is more of a sveltekit problem actually: sveltejs/kit#11956 |
I'm have same issue, any updates? |
I need a MRE to take a closer look: https://sveltelab.dev/github.com/ciscoheat/superforms-examples/tree/zod |
I see that the button won't display the form, but what is the Superforms issue about this? |
^ for sure |
Description
I have been experimenting with shallow routing and found that if you submit a superform (SPA mode) the
$page.state
variable is cleared which consequently kind of 'breaks' shallow routingMy concrete use case is a form on an
/edit
page that I load as a modal via shadow routing (similar to the example from the sveltekit docs). After submitting the form the browser url remains on/edit
but as the state is cleared, the modal is closed.I could not find any information on the lifecycle of the state property and I could not find any code in superforms that would explicitly clear the values.
I also tried
applyAction=false
in hopes that superforms would not touch the $page store, but the value is still reset.So my question is, is this intended behavior? I haven't seen any example using shallow routing, thus I am not sure if my config is somehow broken or it is actually a bug.
The text was updated successfully, but these errors were encountered: