https://github.com/xpl/react-leak
A repro of react-refresh leaking FiberRootNodes from secondary renderers
https://github.com/xpl/react-leak
Last synced: 17 days ago
JSON representation
A repro of react-refresh leaking FiberRootNodes from secondary renderers
- Host: GitHub
- URL: https://github.com/xpl/react-leak
- Owner: xpl
- License: mit
- Created: 2026-04-30T17:36:34.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2026-04-30T17:42:57.000Z (2 months ago)
- Last Synced: 2026-04-30T19:17:27.737Z (2 months ago)
- Language: JavaScript
- Size: 8.79 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# How to run
```
npm i
npm run dev
```
# What happens
react-refresh leaks FiberRootNodes from secondary renderers.
When R3F's Canvas unmounts, react-refresh's onCommitFiberRoot sees a late commit (didError=true, !wasMounted && !isMounted) and adds the root to `failedRoots` / `helpersByRoot` — never cleaned up.
Click the button, then observe all 16 values stay "alive" in dev mode.
In a production build (no react-refresh) they are properly GC'd.
After pressing "Collect garbage" button in Devtools:

---
In production build (note the last value is still retained, [but that is a separate issue in R3F that I have investigated and reported](https://github.com/pmndrs/react-three-fiber/pull/3747)):

# Bug report
https://github.com/facebook/react/issues/36379