When unmounting a Fragment node, it's children are removed from the DOM one at a time instead of all at once
Do you want to request a feature or report a bug?
Bug (maybe! - or perhaps it's just a limitation of Fragments - let me know!)
What is the current behavior?
When unmounting a Fragment, it's children are removed from the DOM one at time top to bottom.
This means if during the unmounting step if I'm quickly calculating where it is in the DOM, its position can change before I can save that data. I also imagine it's less performant.
Look in your console for the outputs for these.
1a) Using Fragment - Element can be found:
1b) Using Fragment - Element can't be found:
2a) Using div - Element can be found (expected behaviour for Fragment):
2b) Using div - Element can't be found (when switching out parent with children, with parent with no children):
What is the expected behavior?
That both the Fragments children would be removed from the DOM at the same time, instead of one after the other.
That both children of the div would be removed from the DOM at the same time when essentially removing the children.
These both look like they're part of the same problem.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
16.3, unsure if it worked in previous versions.
Let me know if I can help with anything :).
- 1. Calling ReactDOM.render() many many times is slow
- 2. Bug: React function component unmounts on state change.
- 3. Bug: SuspenseList revealOrder="backwards" is not consistent without tail props
- 4. Bug: disableRemotePlayback not recognized
- 5. Bug: react test utils do not work together with esm module