This repo demonstrates what I think is a bug in SvelteKit’s
use:enhance
. Form behavior is different with
use:enhance
than without it.
Steps to reproduce the bug:
- Make a
script
block that assigns a variable from adata
field. - Make a form.
- In the form, make an input field with
value={myvariable}
. - In
+page.server.js
, save the newly-set value in the form's action. Inload
, return the new value.
With a plain HTML form, the newly set value gets put into the input field as expected after form submission.
If you add use:enhance
to the form, the input field is blank after submission.