defaultValue
incorrectly (?) diffed against prerendered HTML
#4340
Labels
defaultValue
incorrectly (?) diffed against prerendered HTML
#4340
Describe the bug
Rendering an input with
defaultValue
set runs into a bit of an issue with prerendered HTML as the HTML element will havevalue
set (sincce there's nodefaultValue
attribute), but when Preact goes to diff it against the corresponding JS, it will clear outvalue
and setdefaultValue
on the element. If onlydefaultValue
were set this wouldn't be an issue, but explicitly clearing outvalue
meansdefaultValue
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 setvalue
&defaultValue
whendefaultValue
is incoming (I think).Bit of a weird situation that can be solved by using
value
tbh.Related: denoland/fresh#2406
To Reproduce
Reproduction
Steps to reproduce the behavior:
defaultValue
prop is set,value
is 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.The text was updated successfully, but these errors were encountered: