An open API service indexing awesome lists of open source software.

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

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:

Screenshot 2026-04-30 at 12 25 56 PM

---

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)):

Screenshot 2026-04-30 at 12 32 24 PM

# Bug report

https://github.com/facebook/react/issues/36379