[devtools] Prevent incorrect render detection for user components in didFiberRender (#33423)#94
[devtools] Prevent incorrect render detection for user components in didFiberRender (#33423)#94everettbu wants to merge 1 commit into
Conversation
Improve rendering detection accuracy by adding actual input change verification for user components that have PerformedWork flag set. This prevents showing "The parent component rendered" message and highlight updates for components that didn't actually re-render due to bailouts. - Add props/state/ref comparison for user components after PerformedWork check - Restore original props comparison logic for host components - Fixes issue where bailout components were incorrectly marked as rendered
Greptile OverviewGreptile SummaryFixed false positive rendering detection in React DevTools Profiler by enhancing the Key Changes:
Minor Issue:
Confidence Score: 4/5
Important Files ChangedFile Analysis
|
|
This pull request has been automatically marked as stale. If this pull request is still relevant, please leave any comment (for example, "bump"), and we'll keep it open. We are sorry that we haven't been able to prioritize reviewing it yet. Your contribution is very much appreciated. |
|
Closing this pull request after a prolonged period of inactivity. If this issue is still present in the latest release, please ask for this pull request to be reopened. Thank you! |
Mirror of facebook/react#33434
Original author: developerjhp
Summary
Fixes false positive rendering detection in React DevTools Profiler by improving the
didFiberRenderfunction to accurately detect when user components actually re-render, preventing misleading "The parent component rendered" messages.Problem
Previously, React DevTools would incorrectly mark components as "rendered" even when they didn't actually re-render due to bailouts. This happened because the
didFiberRenderfunction only checked thePerformedWorkflag, but React can set this flag even during bailout scenarios.Example scenario:
Solution
Enhanced
didFiberRenderfunction for user components (ClassComponent, FunctionComponent, etc.):This change ensures that:
PerformedWorkflag (performance optimization)Testing
Test Setup:
Used the following test case with independent Count and Greeting components:
Test Results:
✅ Tested and verified with this code
// Before
Screen.Recording.2025-06-04.at.13.17.03.mov
// After
Screen.Recording.2025-06-04.at.13.17.35.mov
Before Fix:
After Fix:
Related
This change specifically targets user components (Function/Class components) and maintains existing behavior for host components, ensuring accurate rendering detection across the React component tree.
Fixes react/react#33423 , react/react#19732