-
-
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: convert input value to number on hydration #14349
Conversation
🦋 Changeset detectedLatest commit: 45fa6b7 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 |
preview: https://svelte-dev-git-preview-svelte-14349-svelte.vercel.app/ this is an automated message |
Is this something we can capture with a test case or is it specific to FF? |
|
looked a bit into the tests, probably a mix between |
and that's easier said than done, the only way i could find to change the input.value before the hydration step was this absolute hack: export default test({
props: {
value: 2
},
snapshot(target) {
const input = target.querySelector('input')
if (input) input.value = "4"
return {
input,
p: target.querySelector('p')
};
},
test(assert, target, _, component, window) {
assert.equal(component.value, 4);
}
}); |
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.
thanks!
further fixes #1755 when input is of type "number", currently the binding is set to a string if the default doesn't match.
this gets triggered frequently on Firefox, as it restores input values immediately after a refresh, before the content gets hydrated.