You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The range element with a bound value 0 is omitted from server side rendering. This leads to the range input jumping(from default location) after client side js takes over. This issue seems to stem from 0 being a falsy value in Javascript.
To Reproduce
To reproduce you can use this repository by Rich https://github.com/Rich-Harris/svelte-d3-arc-demo
Updating the dependencies to latest versions does not solve the issue. If the client side JS takes over too fast you can disable JS or throttle the network to observe the issue.
The only change you need to do before building is in this file /src/Viz.svelte
- let angle = Math.PI * 2;
+ let angle = 0;
After building you can observe the following in /build/Viz-ssr.js
Expected behavior
Input type range value 0 is included to the html.
Information about your Svelte project:
Firefox nightly
Windows 10
Svelte version 3.19.2
Rollup
Severity
Low severity since this can be worked around by offsetting the range to not include 0. But it's a bit annoying especially if you have a bad approach for reverting the offset.
edit: seems like let angle = "0"; might be a more simple workaround if you don't need math or number methods
Additional context
This issue also happens for for any binding of integers such as with number input. However, it is not quite as visually displeasing as only the value changes from empty to 0, rather than moving around the window.
The text was updated successfully, but these errors were encountered:
Would it be enough to check boolean && !value && value !== 0)? I guess if some consumers are using 0 1 boolean logic then this is not an option. It just seems like a lot more work to do some kind of whitelist in the Element.ts
My environment is not passing all tests so I'm currently having a bit of a hard time to test solutions.
Describe the bug
The range element with a bound value 0 is omitted from server side rendering. This leads to the range input jumping(from default location) after client side js takes over. This issue seems to stem from 0 being a falsy value in Javascript.
To Reproduce
To reproduce you can use this repository by Rich https://github.com/Rich-Harris/svelte-d3-arc-demo
Updating the dependencies to latest versions does not solve the issue. If the client side JS takes over too fast you can disable JS or throttle the network to observe the issue.
The only change you need to do before building is in this file
/src/Viz.svelte
After building you can observe the following in
/build/Viz-ssr.js
The resulting
index.html
does not contain a value for the range input.Expected behavior
Input type range value 0 is included to the html.
Information about your Svelte project:
Firefox nightly
Windows 10
Svelte version 3.19.2
Rollup
Severity
Low severity since this can be worked around by offsetting the range to not include 0. But it's a bit annoying especially if you have a bad approach for reverting the offset.
My current workaround:
edit: seems like
let angle = "0";
might be a more simple workaround if you don't need math or number methodsAdditional context
This issue also happens for for any binding of integers such as with number input. However, it is not quite as visually displeasing as only the value changes from empty to 0, rather than moving around the window.
The text was updated successfully, but these errors were encountered: