Skip to content

[DevTools] Stop setting unused global variables#359

Closed
everettbu wants to merge 2 commits into
mainfrom
sebbie/01-16-_devtools_stop_setting_unused_global_variables
Closed

[DevTools] Stop setting unused global variables#359
everettbu wants to merge 2 commits into
mainfrom
sebbie/01-16-_devtools_stop_setting_unused_global_variables

Conversation

@everettbu

@everettbu everettbu commented Jan 16, 2026

Copy link
Copy Markdown

Mirror of facebook/react#35532
Original author: eps1lon


We no longer set the following globals since they're not read by DevTools. It also doesn't look like they had any meaningful values anymore which was hidden by missing Flow coverage.

  • __REACT_DEVTOOLS_APPEND_COMPONENT_STACK__
  • __REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__
  • __REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__
  • __REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__
  • __REACT_DEVTOOLS_DISABLE_SECOND_CONSOLE_LOG_DIMMING_IN_STRICT_MODE__

__REACT_DEVTOOLS_COMPONENT_FILTERS__ is still set since it's still in use (although not fully functional in the browser extension which I intend to fix).

@everettbu everettbu added CLA Signed React Core Team Opened by a member of the React Core Team labels Jan 16, 2026
@everettbu
everettbu force-pushed the sebbie/01-16-_devtools_stop_setting_unused_global_variables branch from c8122cc to 3d6180c Compare January 16, 2026 12:14
@everettbu
everettbu marked this pull request as ready for review January 16, 2026 13:24
@greptile-apps

greptile-apps Bot commented Jan 16, 2026

Copy link
Copy Markdown

Greptile Summary

This PR removes unused global variables from React DevTools that are no longer read by the DevTools system. The PR eliminates 5 global variables that had no meaningful values and were not being used:

  • __REACT_DEVTOOLS_APPEND_COMPONENT_STACK__
  • __REACT_DEVTOOLS_BREAK_ON_CONSOLE_ERRORS__
  • __REACT_DEVTOOLS_SHOW_INLINE_WARNINGS_AND_ERRORS__
  • __REACT_DEVTOOLS_HIDE_CONSOLE_LOGS_IN_STRICT_MODE__
  • __REACT_DEVTOOLS_DISABLE_SECOND_CONSOLE_LOG_DIMMING_IN_STRICT_MODE__

The PR keeps __REACT_DEVTOOLS_COMPONENT_FILTERS__ as it is still actively used throughout the codebase. Additionally, the PR:

  • Adds Flow type annotations to improve type safety in packages/react-devtools-extensions/src/main/index.js
  • Removes unused event listeners for editor pane visibility events (extensionEditorPaneShown/extensionEditorPaneHidden)
  • Exports additional types (Message, SavedPreferencesParams, FrontendEvents) from the bridge module to support the new type annotations
  • Adds missing event type definitions to the Logger

This is a straightforward cleanup that reduces technical debt and improves code maintainability by removing dead code.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • This is a clean refactoring that removes dead code. The removed global variables are confirmed to be unused in the codebase (verified via grep). The PR also improves type safety by adding Flow annotations. The changes are well-scoped and don't introduce any new functionality or modify existing behavior - they only remove unused code and add type definitions.
  • No files require special attention

Important Files Changed

Filename Overview
packages/react-devtools-extensions/src/main/index.js Added Flow type annotations and removed unused event listeners for editor pane show/hide events
packages/react-devtools-inline/src/backend.js Removed assignments of 5 unused global variables, keeping only __REACT_DEVTOOLS_COMPONENT_FILTERS__

@everettbu

Copy link
Copy Markdown
Author

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

@everettbu everettbu closed this Jan 16, 2026
@everettbu
everettbu deleted the sebbie/01-16-_devtools_stop_setting_unused_global_variables branch January 16, 2026 16:16
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