I encountered a behaviour, that I think can be considered a bug, unless it was intentionally introduced with preact X.
This is a common way to force unmount of components in a specific container:
render(<div />, container, container.firstElementChild)
Using this on the following HTML with preact 8, results in componentWillUnmount of the component being properly called. (Note that the component can be as deeply nested inside the container as wished)
<div id="container">
<div>
<MyComponent />
</div>
</div>
With preact X however, the component is not unmounted, which is really bad for my understanding. There now is no way, that I know of, to achieve emptying a container and properly unmouting all components inside. This is specifically bad for single page applications, like mine, that do this frequently.
If the component is not nested, but a direct child of the container, it even works with preact X.
<div id="container">
<MyComponent />
</div>
Here I have two exactly similar codepens showing this behaviour, only different in the preact version. One runs with 8.5.2 and one with 10.0.5.
preact 8: https://codepen.io/timonwitt/pen/NWPqwxO
preact X: https://codepen.io/timonwitt/pen/BayNwzW
I encountered a behaviour, that I think can be considered a bug, unless it was intentionally introduced with preact X.
This is a common way to force unmount of components in a specific container:
Using this on the following HTML with preact 8, results in componentWillUnmount of the component being properly called. (Note that the component can be as deeply nested inside the container as wished)
With preact X however, the component is not unmounted, which is really bad for my understanding. There now is no way, that I know of, to achieve emptying a container and properly unmouting all components inside. This is specifically bad for single page applications, like mine, that do this frequently.
If the component is not nested, but a direct child of the container, it even works with preact X.
Here I have two exactly similar codepens showing this behaviour, only different in the preact version. One runs with 8.5.2 and one with 10.0.5.
preact 8: https://codepen.io/timonwitt/pen/NWPqwxO
preact X: https://codepen.io/timonwitt/pen/BayNwzW