/use-enhance-bug

Repro case of SvelteKit bug with use:enhance

Primary LanguageSvelte

use:enhance bug?

This repo demonstrates what I think is a bug in SvelteKit’s use:enhance. Form behavior is different with use:enhance than without it.

See sveltejs/kit#8513

Steps to reproduce the bug:

  1. Make a script block that assigns a variable from a data field.
  2. Make a form.
  3. In the form, make an input field with value={myvariable}.
  4. In +page.server.js, save the newly-set value in the form's action. In load, 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.