ITADN

Enhanced forms should make one request when submitted, not two

#16691Openldhenk 创建于 13 天前
L
ldhenkcommented
### Describe the bug I'm working on an application written with SvelteKit that makes heavy use of Form Actions and use:enhance. Unfortunately, every form submission feels extra sluggish in large part because it triggers two round trips in sequence: the form submission itself followed by a subsequent invalidateAll. This approximately doubles the apparent slowness on high-latency connections. Instead, the newly updated page data should be included in the response to the initial form submission, so that only a single round trip is required. This is already what happens when the form is submitted with javascript disabled, so it's unfortunate that trying to enhance the form submission UX in fact significantly degrades it in this way. I don't know whether the svelte team classifies performance issues like this as bugs, so apologies if I've chosen an inappropriate label. ### Reproduction https://github.com/ldhenk/sveltekit-doublereq-demo - Run project - Open dev tools and enable throttling - Click the button - Observe two requests complete in sequence before the count increments ### Logs ```Shell ``` ### System Info ```Shell N/A ``` ### Severity serious, but I can work around it ### Additional Information _No response_
2 条评论