[DOM] Unobserve fragment IntersectionObserver targets after exit - #37408
Conversation
…record Keep deleted first-level children observed until after paint so disconnect still delivers isIntersecting: false, then drop the observer's strong refs. ResizeObserver targets are unobserved immediately.
|
Comparing: 2dc7da7...c5620ec 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
Generated by sizebot against c5620ec |
|
@eps1lon I'm not sure how to wire up in Fabric yet, @rubennorte is it possible to use |
What is the downside of not doing that (i.e. just unobserve immediately). |
|
@eps1lon if you are tracking the state of a list of children to understand if all/none/some are in view, a deleted child that is unobserved immediately doesn't get the exit record so you'd continue to track the item as intersecting forever. |
) Fragment IntersectionObserver targets used to stay observed after a child was removed so the exit record (isIntersecting: false) could still fire, but that left the observer holding detached nodes. We now unobserve ResizeObserver targets immediately, and delay IntersectionObserver unobserve until after paint so the exit still lands, then drop the strong ref. If the same node is reinserted before that flush, we cancel the pending unobserve so a later cleanup does not detach a child that’s still visible. Closes #37452 Closes #37302 Fixes #37451 DiffTrain build for [065bc84](065bc84)
) Fragment IntersectionObserver targets used to stay observed after a child was removed so the exit record (isIntersecting: false) could still fire, but that left the observer holding detached nodes. We now unobserve ResizeObserver targets immediately, and delay IntersectionObserver unobserve until after paint so the exit still lands, then drop the strong ref. If the same node is reinserted before that flush, we cancel the pending unobserve so a later cleanup does not detach a child that’s still visible. Closes #37452 Closes #37302 Fixes #37451 DiffTrain build for [065bc84](065bc84)
…ct#37408) Fragment IntersectionObserver targets used to stay observed after a child was removed so the exit record (isIntersecting: false) could still fire, but that left the observer holding detached nodes. We now unobserve ResizeObserver targets immediately, and delay IntersectionObserver unobserve until after paint so the exit still lands, then drop the strong ref. If the same node is reinserted before that flush, we cancel the pending unobserve so a later cleanup does not detach a child that’s still visible. Closes react#37452 Closes react#37302 Fixes react#37451 DiffTrain build for [065bc84](react@065bc84)
…ct#37408) Fragment IntersectionObserver targets used to stay observed after a child was removed so the exit record (isIntersecting: false) could still fire, but that left the observer holding detached nodes. We now unobserve ResizeObserver targets immediately, and delay IntersectionObserver unobserve until after paint so the exit still lands, then drop the strong ref. If the same node is reinserted before that flush, we cancel the pending unobserve so a later cleanup does not detach a child that’s still visible. Closes react#37452 Closes react#37302 Fixes react#37451 DiffTrain build for [065bc84](react@065bc84)
…ct#37408) Fragment IntersectionObserver targets used to stay observed after a child was removed so the exit record (isIntersecting: false) could still fire, but that left the observer holding detached nodes. We now unobserve ResizeObserver targets immediately, and delay IntersectionObserver unobserve until after paint so the exit still lands, then drop the strong ref. If the same node is reinserted before that flush, we cancel the pending unobserve so a later cleanup does not detach a child that’s still visible. Closes react#37452 Closes react#37302 Fixes react#37451 DiffTrain build for [065bc84](react@065bc84)
…ct#37408) Fragment IntersectionObserver targets used to stay observed after a child was removed so the exit record (isIntersecting: false) could still fire, but that left the observer holding detached nodes. We now unobserve ResizeObserver targets immediately, and delay IntersectionObserver unobserve until after paint so the exit still lands, then drop the strong ref. If the same node is reinserted before that flush, we cancel the pending unobserve so a later cleanup does not detach a child that’s still visible. Closes react#37452 Closes react#37302 Fixes react#37451 DiffTrain build for [065bc84](react@065bc84)
Fragment IntersectionObserver targets used to stay observed after a child was removed so the exit record (isIntersecting: false) could still fire, but that left the observer holding detached nodes. We now unobserve ResizeObserver targets immediately, and delay IntersectionObserver unobserve until after paint so the exit still lands, then drop the strong ref.
If the same node is reinserted before that flush, we cancel the pending unobserve so a later cleanup does not detach a child that’s still visible.
Closes #37452
Closes #37302
Fixes #37451