Skip to content

fix[react-devtools]: Prevent duplicate node errors during rapid navigation in DevTools#36794

Open
vidipsingh wants to merge 1 commit into
react:mainfrom
vidipsingh:fix/uncaught-error
Open

fix[react-devtools]: Prevent duplicate node errors during rapid navigation in DevTools#36794
vidipsingh wants to merge 1 commit into
react:mainfrom
vidipsingh:fix/uncaught-error

Conversation

@vidipsingh

Copy link
Copy Markdown

Summary

Fixes: #36789

Fixes "Cannot add node 'X' because a node with that id is already in the Store" error occurring during rapid navigation in Next.js apps with Node 24+. The issue was caused by a race condition where multiple DevTools mount attempts would subscribe to the same bridge operations event, causing duplicate node additions. The fix implements graceful duplicate handling in the Store, improves cleanup synchronization by shutting down the bridge before UI unmount, and increases the debounce timeout from 500ms to 750ms to accommodate faster execution in modern JavaScript runtimes.

How did you test this change?

  • Verified locally by testing with Next.js app on Node 24 with rapid navigation and Fast Refresh cycles.

  • Passing run: Before the fix, rapid page navigation in Next.js consistently threw "Cannot add node" errors in the DevTools console, breaking the component tree view. After applying the changes, navigated rapidly between pages 20+ times with zero errors and smooth DevTools updates.

  • Failure prevention: Temporarily removed the duplicate check, which successfully reproduced the original error "Cannot add node '24' because a node with that id is already in the Store", confirming the fix prevents the issue. Also verified backward compatibility by testing with Node 18 and older Next.js versions - all scenarios worked correctly.

@meta-cla

meta-cla Bot commented Jun 15, 2026

Copy link
Copy Markdown

Hi @vidipsingh!

Thank you for your pull request and welcome to our community.

Action Required

In order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@meta-cla

meta-cla Bot commented Jun 15, 2026

Copy link
Copy Markdown

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@meta-cla meta-cla Bot added the CLA Signed label Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

2 participants