The Wire · Showcase
React Fragments leak listeners as refs re-attach
By RepoJournal · Filed · About Meta
A subtle React bug is piling up event listeners when Fragment refs re-attach with a fresh identity on each render.
React pushed a fix for a listener-leak in Fragment refs: an inlined ref callback gets a new identity every render, so React marks the Ref flag and re-attaches, but the matching detach was missing, letting event listeners accumulate [1]. The PR lands a test that characterizes the issue and the fix during the mutation phase [2]. In the same 24 hours, React Native shipped a breaking docs rework that renames `__doc__` to `__docs__` and drops two superseded docs [3]. More urgently, Animated had a bug where `value.addListener(cb)` stopped firing forever after any bound component unmounted, even with the value still alive and animating; that's now fixed so user-registered listeners survive detach [4]. Android devs get a new `InspectorNetworkReporter` integration point so third-party networking stacks can surface CDP and Web Performance events in the DevTools Network panel [5]. Jest's runtime continues its Node-parity march, keying ES modules by full URL and sharing modules between overlapping graphs, which alone is worth pulling for anyone hitting ESM cache collisions [6]. SimenB also fixed `sandboxInjectedGlobals` binding under `injectGlobals: false` [7] and matched Node's behavior for `"type": "commonjs"` packages, `module.children`, and `data:` URIs [8].
One email a day. Unsubscribe in one click.
Keep up with Meta in about 3 minutes a day: what actually shipped — the commits, pull requests, releases, and security advisories that matter.
One email a day. Unsubscribe in one click. Read a past issue →
Action items
- → Review React Fragment ref usage and patch to 19.x latest to stop listener accumulation facebook/react [immediate]
- → Upgrade react-native to include the Animated listener fix before relying on addListener after unmount facebook/react-native [immediate]
- → Update Jest to a runtime including the ESM keying fix if you hit module cache clashes facebook/jest [plan]
- → Watch the SwiftPM docs rename for any build or doc tooling that references the old __doc__ path facebook/react-native [monitor]
References
- [1] [Fiber] Detach Fragment refs during the mutation phase ↗ facebook/react
- [2] [Fiber] Detach Fragment refs during the mutation phase (#37326) facebook/react
- [3] docs(swiftpm): rename __doc__ to __docs__, drop two superseded docs, correct the rest (#58006) facebook/react-native
- [4] fix(animated): keep user-registered listeners when an Animated node detaches (#57941) facebook/react-native
- [5] Expose InspectorNetworkReporter integration point to Frameworks (Android) (#58012) facebook/react-native
- [6] fix(jest-runtime): key ES modules by full URL and share modules between overlapping graphs ↗ facebook/jest
- [7] fix(jest-runtime): bind `sandboxInjectedGlobals` to the right values ↗ facebook/jest
- [8] fix(jest-runtime): match Node for "type": "commonjs" packages, module.children and data: URIs ↗ facebook/jest