-
-
Notifications
You must be signed in to change notification settings - Fork 2k
Description
- Check if updating to the latest Preact version resolves the issue
Describe the bug
Rendering an input with defaultValue set runs into a bit of an issue with prerendered HTML as the HTML element will have value set (sincce there's no defaultValue attribute), but when Preact goes to diff it against the corresponding JS, it will clear out value and set defaultValue on the element. If only defaultValue were set this wouldn't be an issue, but explicitly clearing out value means defaultValue doesn't do much of anything (to my knowledge).
Fiddled with it a bit, but haven't found a decently golfed solution yet. Need some way to skip setting value or set value & defaultValue when defaultValue is incoming (I think).
Bit of a weird situation that can be solved by using value tbh.
Related: denoland/fresh#2406
To Reproduce
Steps to reproduce the behavior:
- Open repro
- Notice input is empty
- Check console to see that while the
defaultValueprop is set,valueis now an empty string.
Expected behavior
Like if the component was rendered w/out pre-existing HTML, the value should be correctly set so the input contains the right content.