Repository navigation
fix(web): keep form input entered before hydration - #359
Merged
Merged
Conversation
Hydration writes a one-way `value={...}` or `checked={...}` over what the
control holds (sveltejs/svelte#18951), and a select's value the same way
(sveltejs/svelte#18928), so anything typed or ticked before the scripts
loaded was lost: the directory's search and filters, the profile, press
kit, show and claim editors, and the admin forms. Svelte's `bind:`
directives take the control's value while hydrating instead, so each form
now binds to a copy of its values from formFields() (a deep $state copy
that starts over on new values), and selects mark their options
`selected` instead of binding.
The e2e tests fill the directory and the editors before hydration, by
holding the page's scripts, and check the values are still there after.
Coverage Report for apps/web
File Coverage
SizeCompared with main. KiB are 1,024 bytes.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
bnb
previously approved these changes
Nov 1, 2026
bnb
previously approved these changes
Nov 1, 2026
# Conflicts: # apps/web/src/lib/components/ProjectForm.svelte # apps/web/src/routes/projects/+page.svelte
botandbang
enabled auto-merge
November 1, 2026 20:20
bnb
approved these changes
Nov 1, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What and why
Anything typed or ticked before the page's scripts loaded was lost when the page hydrated. That covered the directory's search and filters, the profile, press kit, show and claim editors, and the admin forms. Svelte writes a one-way
value={...}orchecked={...}over the control while hydrating (sveltejs/svelte#18951, with a select's value the same in sveltejs/svelte#18928), while itsbind:directives keep the control's value. Each form now binds to a copy of its values from a small shared helper,formFields()(a deep$statecopy that starts over on new values, so navigations and failed submits reset the form as before). Selects mark their optionsselectedinstead of binding. 12 pages and 8 components changed.Stacked on #357.
How it was tested
Two e2e tests fill the directory and the editors before hydration by holding the page's scripts. They fail on the parent commit and pass 10 of 10 runs now. Unit tests cover
formFields()and the editors starting over. The Chromium e2e suite (26/26), format, lint, check, test, knip and coverage pass. Coverage dropped 0.18 points in statements and 0.19 in branches from compiler-generated binding code, still above the thresholds.Not fixed
A place typed into the location field before hydration keeps the old hidden coordinates, which was already the case.