preactjs / preact

⚛️ Fast 3kB React alternative with the same modern API. Components & Virtual DOM.
https://preactjs.com
MIT License
36.81k stars 1.95k forks source link

Add support for multiple roots with useId #3781

Open marvinhagemeister opened 2 years ago

marvinhagemeister commented 2 years ago

Describe the bug

There may be clashes in ids with multiple roots in the same page. This is a follow-up issue to #3772 . See: https://github.com/preactjs/preact/issues/3772#issuecomment-1291460015

To Reproduce

https://codesandbox.io/s/preact-useid-multiple-y0qbwq?file=/src/index.js

Expected behavior What should have happened when following the steps above?

fromaline commented 2 years ago

I am interested in fixing this bug. What is the expected behavior in this case? Unique id for each root, like in React?

igorbrasileiro commented 1 year ago

Do you know if we have news here? I'm interested in this because Deno Fresh islands architecture leverages multiple renders and causes this bug.