-
Notifications
You must be signed in to change notification settings - Fork 24.5k
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
Fix error when trying to unobserve detached targets in IntersectionObserver #41454
Conversation
This pull request was exported from Phabricator. Differential Revision: D51257960 |
Base commit: 686f83e |
…server (facebook#41454) Summary: Yet another problem caused by React being too aggressive cleaning up detached fibers. This fixes a problem in `IntersectionObserver` when trying to `unobserve` detached targets. In that case we didn't have access to its shadow node anymore, so we didn't have a way to unobserve in native. This keeps an additional mapping in JS to do the conversion even after detached. Changelog: [internal] Differential Revision: D51257960
…server (facebook#41454) Summary: Yet another problem caused by React being too aggressive cleaning up detached fibers. This fixes a problem in `IntersectionObserver` when trying to `unobserve` detached targets. In that case we didn't have access to its shadow node anymore, so we didn't have a way to unobserve in native. This keeps an additional mapping in JS to do the conversion even after detached. Changelog: [internal] Differential Revision: D51257960
dc36601
to
72c0522
Compare
This pull request was exported from Phabricator. Differential Revision: D51257960 |
…server (facebook#41454) Summary: Yet another problem caused by React being too aggressive cleaning up detached fibers. This fixes a problem in `IntersectionObserver` when trying to `unobserve` detached targets. In that case we didn't have access to its shadow node anymore, so we didn't have a way to unobserve in native. This keeps an additional mapping in JS to do the conversion even after detached. Changelog: [internal] Reviewed By: rshest Differential Revision: D51257960
72c0522
to
78e11d5
Compare
…server (facebook#41454) Summary: Yet another problem caused by React being too aggressive cleaning up detached fibers. This fixes a problem in `IntersectionObserver` when trying to `unobserve` detached targets. In that case we didn't have access to its shadow node anymore, so we didn't have a way to unobserve in native. This keeps an additional mapping in JS to do the conversion even after detached. Changelog: [internal] Reviewed By: rshest Differential Revision: D51257960
This pull request was exported from Phabricator. Differential Revision: D51257960 |
78e11d5
to
99fe8e6
Compare
…server (facebook#41454) Summary: Yet another problem caused by React being too aggressive cleaning up detached fibers. This fixes a problem in `IntersectionObserver` when trying to `unobserve` detached targets. In that case we didn't have access to its shadow node anymore, so we didn't have a way to unobserve in native. This keeps an additional mapping in JS to do the conversion even after detached. Changelog: [internal] Reviewed By: rshest Differential Revision: D51257960
This pull request was exported from Phabricator. Differential Revision: D51257960 |
…server (facebook#41454) Summary: Yet another problem caused by React being too aggressive cleaning up detached fibers. This fixes a problem in `IntersectionObserver` when trying to `unobserve` detached targets. In that case we didn't have access to its shadow node anymore, so we didn't have a way to unobserve in native. This keeps an additional mapping in JS to do the conversion even after detached. Changelog: [internal] Reviewed By: rshest Differential Revision: D51257960
99fe8e6
to
a2b97bb
Compare
…server (facebook#41454) Summary: Yet another problem caused by React being too aggressive cleaning up detached fibers. This fixes a problem in `IntersectionObserver` when trying to `unobserve` detached targets. In that case we didn't have access to its shadow node anymore, so we didn't have a way to unobserve in native. This keeps an additional mapping in JS to do the conversion even after detached. Changelog: [internal] Reviewed By: rshest Differential Revision: D51257960
This pull request was exported from Phabricator. Differential Revision: D51257960 |
…server (facebook#41454) Summary: Yet another problem caused by React being too aggressive cleaning up detached fibers. This fixes a problem in `IntersectionObserver` when trying to `unobserve` detached targets. In that case we didn't have access to its shadow node anymore, so we didn't have a way to unobserve in native. This keeps an additional mapping in JS to do the conversion even after detached. Changelog: [internal] Reviewed By: rshest Differential Revision: D51257960
a2b97bb
to
5bee7d2
Compare
…server (facebook#41454) Summary: Yet another problem caused by React being too aggressive cleaning up detached fibers. This fixes a problem in `IntersectionObserver` when trying to `unobserve` detached targets. In that case we didn't have access to its shadow node anymore, so we didn't have a way to unobserve in native. This keeps an additional mapping in JS to do the conversion even after detached. Changelog: [internal] Reviewed By: rshest Differential Revision: D51257960
This pull request was exported from Phabricator. Differential Revision: D51257960 |
… Fabric (facebook#27687) (facebook#41452) Summary: ## Summary This fixes an error in `getPublicInstanceFromInstanceHandle` where we throw an error when trying to access the public instance from the fiber of an unmounted component. This shouldn't throw but return `null` instead. ## How did you test this change? Updated unit tests. Before: <img width="969" alt="Screenshot 2023-11-10 at 15 26 14" src="https://github.com/facebook/react/assets/117921/ea161616-2775-4fab-8d74-da4bef48d09a"> After: <img width="1148" alt="Screenshot 2023-11-10 at 15 28 37" src="https://github.com/facebook/react/assets/117921/db18b918-b6b6-4925-9cfc-3b4b2f3ab92d"> DiffTrain build for commit facebook/react@6b3834a. Test Plan: Sandcastle tests Reviewed By: tyao1 Differential Revision: D51203276 Pulled By: tyao1
…k#41451) Summary: After [this change in React](facebook/react#27687), `ReactFabric.getPublicInstanceFromInternalInstanceHandle` can return `null` if the instance handle is a fiber that was unmounted (before that PR, it would throw an error). This modifies the DOM traversal API to gracefully handle that case. Changelog: [internal] Reviewed By: rshest Differential Revision: D51210455
…ver (facebook#41450) Summary: `IntersectionObserver` shouldn't report entries for targets that are no longer being observed by the observer. This wasn't the case before because it was possible to create an intersection observer entry, then unobserve the target and then dispatch the pending entries (including the unobserved target). This fixes that issue to align with Web browsers. Changelog: [internal] Reviewed By: rshest Differential Revision: D51256827
…ntries (facebook#41449) Summary: `IntersectionObserver` was incorrectly throwing errors when reporting entries for detached targets. The problem was that we were deriving the target instance from the instance handle that we keep in native, but React removes the connection between them when the instance handle is unmounted. This fixes the problem by keeping an internal mapping between instance handle and target internally in the intersection observer manager. Changelog: [internal] Reviewed By: rshest Differential Revision: D51210456
…server (facebook#41454) Summary: Yet another problem caused by React being too aggressive cleaning up detached fibers. This fixes a problem in `IntersectionObserver` when trying to `unobserve` detached targets. In that case we didn't have access to its shadow node anymore, so we didn't have a way to unobserve in native. This keeps an additional mapping in JS to do the conversion even after detached. Changelog: [internal] Reviewed By: rshest Differential Revision: D51257960
5bee7d2
to
8c05fb7
Compare
This pull request was exported from Phabricator. Differential Revision: D51257960 |
This pull request has been merged in 11aadb7. |
…server (facebook#41454) Summary: Pull Request resolved: facebook#41454 Yet another problem caused by React being too aggressive cleaning up detached fibers. This fixes a problem in `IntersectionObserver` when trying to `unobserve` detached targets. In that case we didn't have access to its shadow node anymore, so we didn't have a way to unobserve in native. This keeps an additional mapping in JS to do the conversion even after detached. Changelog: [internal] Reviewed By: rshest Differential Revision: D51257960 fbshipit-source-id: 25edc9afd2108e141d178dd4939fc2de8286342b
Summary:
Yet another problem caused by React being too aggressive cleaning up detached fibers. This fixes a problem in
IntersectionObserver
when trying tounobserve
detached targets. In that case we didn't have access to its shadow node anymore, so we didn't have a way to unobserve in native. This keeps an additional mapping in JS to do the conversion even after detached.Changelog: [internal]
Differential Revision: D51257960