Skip to content

[test] Fix DevTools regression tests#330

Closed
everettbu wants to merge 1 commit into
mainfrom
sebbie/01-13-_test_fix_devtools_regression_tests
Closed

[test] Fix DevTools regression tests#330
everettbu wants to merge 1 commit into
mainfrom
sebbie/01-13-_test_fix_devtools_regression_tests

Conversation

@everettbu

Copy link
Copy Markdown

Mirror of facebook/react#35501
Original author: eps1lon


Fixes

IgnoreMe suspended while rendering, but no fallback UI was specified.

-- https://github.com/facebook/react/actions/runs/20886558894/job/60010693969

Regressed in react/react#35456 because in React 17 we can't suspend the root.

It's interesting to test both 17 (because Suspense has a different impl in 17) as well as testing what happens if the root suspends (if the root wouldn't have a dedicated Suspense node, we'd need to change how we handle this case). So we test both React 17 upwards with an explicit root Suspense and React 18 upwards with an implicit one.

Test plan

$ yarn build react-debug-tools react-refresh internal-test-utils
$ ./scripts/ci/download_devtools_regression_build.js 17.0 --replaceBuild
$ node ./scripts/jest/jest-cli.js --build --project devtools --release-channel=experimental --reactVersion 17.0

@everettbu everettbu added CLA Signed React Core Team Opened by a member of the React Core Team labels Jan 13, 2026
@everettbu
everettbu force-pushed the sebbie/01-13-_test_fix_devtools_regression_tests branch from 318e92c to 98005c3 Compare January 13, 2026 13:22
@everettbu
everettbu marked this pull request as ready for review January 13, 2026 13:24
@greptile-apps

greptile-apps Bot commented Jan 13, 2026

Copy link
Copy Markdown

Greptile Overview

Greptile Summary

This PR fixes a React DevTools regression test that was failing in React 17 due to attempting to suspend the root without a fallback component.

What Changed

The original test "should track suspended by in filtered fallback" (React 17+) has been split into three separate tests:

  1. React 18+ root suspension test: Keeps the original behavior of suspending the root directly without an outer Suspense boundary (React 18+ supports this)
  2. React 17 test: Adds an explicit root Suspense boundary with a non-suspending fallback
  3. React 18 test: Also includes the root Suspense boundary for comparison with React 17 behavior

Key Implementation Details

  • Component conditional logic: The Component function now checks if a promise prop exists before calling readValue, allowing it to render null when used as the root fallback without a promise prop
  • Proper test isolation: Each test version correctly tests suspended-by tracking in filtered components while handling React version-specific Suspense behavior differences
  • Accurate snapshots: React 17 and 18 tests have different first snapshots (React 17 shows the main Suspense boundary immediately due to partial tree commits, React 18 does not), but subsequent snapshots are identical

Why This Fix Works

In React 17, suspending the root without a fallback causes a runtime error. The fix wraps the entire component tree in a root Suspense boundary with a Component instance that receives no promise prop as the fallback. This Component returns null instead of suspending, providing the required non-suspending fallback rendering.

The changes follow existing patterns in the codebase and maintain the original test purpose of verifying that DevTools correctly tracks suspended components even when filtered out.

Confidence Score: 5/5

  • This PR is safe to merge with no identified risks
  • The changes correctly fix a React 17 regression by splitting one test into three version-specific tests with appropriate Suspense boundaries. The implementation follows existing patterns in the codebase, uses proper version annotations, and includes accurate snapshots that reflect actual React 17 vs 18 behavior differences. No logic errors, edge cases, or inconsistencies were found.
  • No files require special attention

Important Files Changed

File Analysis

Filename Score Overview
packages/react-devtools-shared/src/tests/store-test.js 5/5 Fixes React 17 regression by splitting test into version-specific variants with proper Suspense boundaries. Original test suspended the root (unsupported in React 17), now has explicit root Suspense for React 17/18 tests and separate React 18+ root suspension test.

@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.

No 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 Jan 13, 2026
@everettbu
everettbu deleted the sebbie/01-13-_test_fix_devtools_regression_tests branch January 13, 2026 15:18
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