TypeError: Cannot set properties of null (setting '__m')
with preact 10.19.4 when destroying a component that calls useId
#4277
Labels
Describe the bug
We have a helper which renders components via
render(<SomeJSX />, container)
(wherecontainer
is anHTMLElement
), and then destroys them viarender(null, container)
to make sure side effect clean-ups are executed.This worked fine with preact <=10.19.3, but with 10.19.4 it throws an error when
render(null, container)
is called, only if the rendered component is internally usinguseId()
.To Reproduce
Create a component that calls
useId()
, then render it and then destroy itYou can see the error in action here https://stackblitz.com/edit/create-preact-starter-wih6a1?file=src%2Findex.jsx
Basically, as soon as the component has a call to
useId()
, it crashes when callingrender(null, container)
.Steps to reproduce the behavior:
If you remove the call to
useId()
or downgrade to preact 10.19.3, the error will not be reproducible.Expected behavior
No error is thrown.
The text was updated successfully, but these errors were encountered: