[DevTools] Attach async info in filtered fallback to parent of Suspense#303
[DevTools] Attach async info in filtered fallback to parent of Suspense#303everettbu wants to merge 2 commits into
Conversation
Greptile SummaryThis PR fixes an issue in React DevTools where async info was incorrectly attached to Suspense boundaries when rendering filtered fallback content. The core problem: When DevTools filters out components (e.g., components matching a name pattern), the tool needs to find an unfiltered parent to attach async information to. Previously, if it landed on a Suspense component that wasn't the actual parent Suspense boundary being reconciled, it would incorrectly attach the async info to that Suspense component. This caused the DevTools to misinterpret which Suspense boundary was being triggered. The fix: After finding an unfiltered parent instance, the code now checks if that instance is a Suspense component that differs from the actual parent Suspense boundary being reconciled. If so, it moves up one more level to use that Suspense component's parent instead. This ensures async info is attached to the correct boundary. Key changes:
Confidence Score: 5/5
Important Files Changed
|
|
Upstream PR was closed or merged. Code is synced via branch mirror. |
Mirror of facebook/react#35456
Original author: eps1lon
Summary
When a DevTools instance is filtered, we're using an unfiltered parent that's still in the reconciling Suspense boundary to attach async info to. If we attach async info to a DEvTools instance of a Suspense boundary, we treat that async info as if it's triggering the fallback of that Suspense boundary.
However, if we're inside the fallback, async info is not triggering the fallback of the nearest Suspense boundary but its parent.
Now we're using the parent of the Suspense boundary to attach async info to if that's not actually the Suspense boundary we're reconciling against (which should only happen if we're reconciling the fallback). We should always have a parent of a DevTools instance associated with a Suspense boundary if we're reconciling the fallback. The only DevTools instance associated with a Suspense boundary without a parent is the Host root. But a host root doesn't have a fallback so we can ignore that case.
How did you test this change?
Added test passes CI (did fail without this change)
https://tangled.org/danabra.mov/sidetrail no longer triggers an instrumentation error
Before:
CleanShot.2026-01-06.at.18.03.45.mp4