denoland / fresh

The next-gen web framework.
https://fresh.deno.dev
MIT License
12.15k stars 619 forks source link

[Bug] Preact's hydrate will clear uncontrolled property(e.g.`defaultValue) #2406

Closed ahuigo closed 3 months ago

ahuigo commented 4 months ago

Preact's hydrate will clear uncontrolled property(e.g., defaultValue="12"), this is wrong

We could see that defaultValue="12" is cleared by client's hydrate.

I'm not sure if this is a fresh bug.

Demo:

https://fresh-demo-ahuigo.deno.dev/react/hello

Source code:

https://github.com/ahuigo/fresh-demo/blob/hydrate-bug/islands/react/hello.tsx

rschristian commented 4 months ago

This doesn't appear to be a hydration bug actually, as hydration shouldn't diff props, but a bug in Preact's render diffing I think.

To reproduce: Repl

Looks like render() will update the defaultValue prop but clear value