-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: ensure bound input content is resumed on hydration #11986
Conversation
🦋 Changeset detectedLatest commit: 3fd07ae The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense / is it possible to apply this logic to other inputs? bind:value
for the select and bind:group
come to mind.
packages/svelte/src/internal/client/dom/elements/bindings/input.js
Outdated
Show resolved
Hide resolved
packages/svelte/src/internal/client/dom/elements/bindings/input.js
Outdated
Show resolved
Hide resolved
…t.js Co-authored-by: Simon H <[email protected]>
Finally! I think we probably do need to apply it to other form elements, yeah, if it doesn't already work. I also wonder if we need to fire |
packages/svelte/src/internal/client/dom/elements/bindings/input.js
Outdated
Show resolved
Hide resolved
I added a test case that shows hydration working correctly :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Test adjustment looks great! Can you add a test for bind:group
aswell? And did you look into whether or not it's feasible to handle <select bind:value />
?
packages/svelte/src/internal/client/dom/elements/bindings/input.js
Outdated
Show resolved
Hide resolved
…t.js Co-authored-by: Simon H <[email protected]>
Seems to work already. I didn't need to change anything. |
@trueadm I'm seeing a few things. <script>
let checked = $state(false);
</script>
<input type="checkbox" bind:checked /> Will reset to initial value on a slow connection. As soon as all JS loads, it'll reset back to being unchecked. |
Fixes #1755.
Before:
Screen.Recording.2024-06-10.at.13.06.17.mov
After:
Screen.Recording.2024-06-10.at.13.05.11.mov