New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Null reference scenario with unkeyed children #753
Comments
Here's a failing test:
|
Interesting, this seems to happen due to elements shifting on removal. |
I read somewhere that preact v8 preserves empty slots. That approach might also be useful here, as in that case, the second div would not morph into the first one. |
Yup - that's why I was surprised to see this issue. |
Recently stumbled across the same issue. |
Related to #1440 |
I found a problem with using
ref
on unkeyed children. You can observe the problem here: https://jsfiddle.net/rsm2dxb7/1/Open the console and click Toggle. You'll see that the final dom reference being passed is
null
, which is wrong because the referenced div is still there.In the example, the first child is conditionally rendered and the second child is using a
ref
. On click, the state changes and the first child is unmounted. The ref callback is called two times in wrong order, so the final reference value is null.The text was updated successfully, but these errors were encountered: