Skip to content

[DevTools] Fix broken commit tree builder for initial operations#478

Closed
everettbu wants to merge 3 commits into
mainfrom
sebbie/02-06-_devtools_stop_sending_current_root_id_in_operations
Closed

[DevTools] Fix broken commit tree builder for initial operations#478
everettbu wants to merge 3 commits into
mainfrom
sebbie/02-06-_devtools_stop_sending_current_root_id_in_operations

Conversation

@everettbu

@everettbu everettbu commented Feb 6, 2026

Copy link
Copy Markdown

Mirror of facebook/react#35710
Original author: eps1lon


Summary

Originally thought we can stop sending the root ID entirely but it's used by the commit tree builder. That made me realize react/react#35093 introduced a regression.

Flushing pending events is only safe without a root if we're not profiling or if we're flushing events that don't mutate the tree (e.g. console errors and warnings)

Also removes handling of TREE_OPERATION_REMOVE_ROOT in various frontends since that operation is no longer sent by the backend.

How did you test this change?

  • CI

@everettbu everettbu added CLA Signed React Core Team Opened by a member of the React Core Team labels Feb 6, 2026
@everettbu everettbu changed the title [DevTools] Stop sending current root ID in operations [DevTools] Fix broken commit tree builder for initial operations Feb 6, 2026
@everettbu
everettbu marked this pull request as ready for review February 6, 2026 11:27
@greptile-apps

greptile-apps Bot commented Feb 6, 2026

Copy link
Copy Markdown

Greptile Overview

Greptile Summary

Fixes regression introduced in PR #35093 where removing the root ID from operations broke the commit tree builder during profiling. The commit tree builder requires the root ID to properly reconstruct the component tree for each commit. This PR adds back the root parameter to flushPendingEvents() and includes the root ID in operations when needed (during profiling or tree mutations), while safely passing null for operations that don't mutate the tree (like error/warning updates). Also cleans up unused TREE_OPERATION_REMOVE_ROOT handling code across frontend components since that operation is no longer sent by the backend.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • The fix properly addresses a regression by restoring necessary root ID information for the commit tree builder while maintaining the optimization of passing null when safe. All call sites have been correctly updated with appropriate context-aware parameters (specific root during profiling/tree mutations, null for error/warning updates). The cleanup of unused TREE_OPERATION_REMOVE_ROOT handling is straightforward dead code removal.
  • No files require special attention

Important Files Changed

Filename Overview
packages/react-devtools-shared/src/backend/fiber/renderer.js Added root parameter to flushPendingEvents() and updated all call sites to pass either a specific root or null based on context (profiling status and operation type)
packages/react-devtools-shared/src/devtools/views/Profiler/CommitTreeBuilder.js Removed handling code for TREE_OPERATION_REMOVE_ROOT operation that is no longer sent

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

2 files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@everettbu

Copy link
Copy Markdown
Author

Upstream PR was closed or merged. Code is synced via branch mirror.

@everettbu everettbu closed this Feb 6, 2026
@everettbu
everettbu deleted the sebbie/02-06-_devtools_stop_sending_current_root_id_in_operations branch February 6, 2026 14:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants