-
Notifications
You must be signed in to change notification settings - Fork 48.8k
New children notify fragment instances in Fabric #33093
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
Conversation
Comparing: 4448b18...503b959 Critical size changesIncludes critical production bundles, as well as any change greater than 2%:
Significant size changesIncludes any change greater than 0.2%: Expand to show
|
This is too early and causes the node to be observed before layout information is available. Going to to work on moving it later. |
9d3ddac
to
ce8e004
Compare
ce8e004
to
cd6dbf0
Compare
Republishing as @rubennorte is working on RN changes to allow the earlier observe on new children. |
|
||
if (!supportsMutation) { | ||
if (enableFragmentRefs) { | ||
appendImmutableNodeToFragmentInstances( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what supportsMutation means, but wanted to point out that we are appending something in the fragment refs path which might be considered a mutation?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
append isn't great naming here. I'll update.
supportsMutation refers to mutation mode https://github.com/facebook/react/blob/main/packages/react-reconciler/README.md#modes
In this case, we're targeting Fabric behavior which does not support mutation.
The append isn't an append to a mutable tree. Its more like letting the parent fragment know it has a new child, independent of the actual insert of that node.
When a new child of a fragment instance is inserted, we need to notify the instance to keep any relevant tracking up to date. For example, we automatically observe the new child with any active IntersectionObserver. For mutable renderers (DOM), we reuse the existing traversal in `commitPlacement` that does the insertions for HostComponents. Immutable renderers (Fabric) exit this path before the traversal though, so currently we can't notify the fragment instances. Here I've created a separate traversal in `commitPlacement`, specifically for immutable renders when `enableFragmentRefs` is on. DiffTrain build for [1835b3f](1835b3f)
When a new child of a fragment instance is inserted, we need to notify the instance to keep any relevant tracking up to date. For example, we automatically observe the new child with any active IntersectionObserver. For mutable renderers (DOM), we reuse the existing traversal in `commitPlacement` that does the insertions for HostComponents. Immutable renderers (Fabric) exit this path before the traversal though, so currently we can't notify the fragment instances. Here I've created a separate traversal in `commitPlacement`, specifically for immutable renders when `enableFragmentRefs` is on. DiffTrain build for [1835b3f](1835b3f)
When a new child of a fragment instance is inserted, we need to notify the instance to keep any relevant tracking up to date. For example, we automatically observe the new child with any active IntersectionObserver.
For mutable renderers (DOM), we reuse the existing traversal in
commitPlacement
that does the insertions for HostComponents. Immutable renderers (Fabric) exit this path before the traversal though, so currently we can't notify the fragment instances.Here I've created a separate traversal in
commitPlacement
, specifically for immutable renders whenenableFragmentRefs
is on.