Replies: 3 comments
-
Actually, I hit the same issue @jro66 any update on this since June? |
Beta Was this translation helpful? Give feedback.
-
Look at this line of your example repo, it's |
Beta Was this translation helpful? Give feedback.
-
Thanks, @mustofa-id I've added an additional directive for redirection purposes as u mentioned. I decided I would share my solution in case someone face a similar problem. to form enhancement function provided here: https://github.com/sveltejs/kit/blob/master/packages/create-svelte/templates/default/src/lib/form.ts
and based on redirect argument existence I invalidate the current URL or not:
And you can use it, in this manner:
|
Beta Was this translation helpful? Give feedback.
-
Hi all,
I'm using page endpoints and native forms enhanced using the starter kit out-of-the-box enhance function. This works great until I have to handle forms that would normally cause a redirect to another page (e.g., just created a new resource, now navigate to a page for that resource).
goto
seems like the solution, however it is not replacing the URL (though in the network tools, I can see it request to the new resource).My endpoint returns something like this:
My form looks something like this:
In my trying of random things, I have found that wrapping the goto in a
setTimeout()
helps, but really is only somewhat consistent when running locally, and when deployed (I'm hosting on Vercel) it still doesn't work most of the time. I suspect this is only hiding the real issue.I couldn't really find any examples of this, am I just doing something wrong?
Edit: Adding a minimal repo demonstrating above:
https://github.com/jro66/sveltekit-goto-demo
Last tested on
[email protected]
.Beta Was this translation helpful? Give feedback.
All reactions