KEMBAR78
[DevTools] Only show boundaries with unique suspenders by default in the timeline by eps1lon · Pull Request #34397 · facebook/react · GitHub
Skip to content

Conversation

@eps1lon
Copy link
Collaborator

@eps1lon eps1lon commented Sep 5, 2025

Stacked on #34422

This gives a more focused timeline by default showing what could've actually caused a fallback with the current state.

It's still useful to see a full timeline for things that may cause fallback in the future if new suspenders are added. Especially since we're currently not dealing with outlining of Fizz/Flight which is harder to model.

Includes fixes to UI alignment in the timeline

CleanShot.2025-09-09.at.11.18.34.mp4

@meta-cla meta-cla bot added the CLA Signed label Sep 5, 2025
@eps1lon eps1lon changed the title [DevTools] Avoid renders of stale Suspense store [DevTools] Show boundaries with unique suspenders only by default in the timeline Sep 5, 2025
@github-actions github-actions bot added the React Core Team Opened by a member of the React Core Team label Sep 5, 2025
@eps1lon eps1lon changed the title [DevTools] Show boundaries with unique suspenders only by default in the timeline [DevTools] Only show boundaries with unique suspenders by default in the timeline Sep 5, 2025
@eps1lon eps1lon force-pushed the sebbie/09-05-_devtools_show_boundaries_with_unique_suspenders_only_by_default_in_the_timeline branch 4 times, most recently from d57a481 to 641632b Compare September 5, 2025 08:26
@eps1lon eps1lon force-pushed the sebbie/09-05-_devtools_show_boundaries_with_unique_suspenders_only_by_default_in_the_timeline branch from 641632b to 91a6b6f Compare September 8, 2025 21:07
@eps1lon eps1lon requested a review from hoxyq September 9, 2025 09:16
@eps1lon eps1lon force-pushed the sebbie/09-05-_devtools_show_boundaries_with_unique_suspenders_only_by_default_in_the_timeline branch 2 times, most recently from aba8c15 to 68caa3b Compare September 9, 2025 09:26
@eps1lon eps1lon marked this pull request as ready for review September 9, 2025 09:27
@eps1lon eps1lon requested a review from sebmarkbage September 9, 2025 11:45
@eps1lon eps1lon force-pushed the sebbie/09-05-_devtools_show_boundaries_with_unique_suspenders_only_by_default_in_the_timeline branch 2 times, most recently from 654b688 to f4b3b80 Compare September 10, 2025 10:20
operations[i++] = SUSPENSE_TREE_OPERATION_SUSPENDERS;
operations[i++] = numSuspenderChanges;
pendingSuspenderChanges.forEach(fiberIdWithChanges => {
const suspense = idToSuspenseNodeMap.get(fiberIdWithChanges);
Copy link
Collaborator

Choose a reason for hiding this comment

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

This look up seems unnecessary. We don't do that elsewhere.

I believe it's also possible that it gets batched such that you can end up deleting it later before it's sent which would then trigger the error below.

You really know that it only goes one direction so it has to be true. Don't really need it in the protocol.

If you do need it, then you should just add it to the set but really the Set is unnecessary too since it can just be an array in order just like the others are.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If you do need it, then you should just add it to the set but really the Set is unnecessary too since it can just be an array in order just like the others are.

I don't trust that during one reconciler pass we can't simultaneously add unique suspenders and remove a node. In that case I need to remove it from the pending change set anyway so a Set makes sense. I could ignore suspender changes for removed nodes but that may hide different bugs.

I believe it's also possible that it gets batched such that you can end up deleting it later before it's sent which would then trigger the error below.

When you record a delete, you're supposed to remove it from the change set. That's what we're currently doing when we also remove the node from ID-map: https://github.com/eps1lon/react/blob/b3281e3b8043e48d78cf4d13e14f7e5a220b3e28/packages/react-devtools-shared/src/backend/fiber/renderer.js#L2752-L2753

We're still erroring in the store if we get a change for a removed node but I prefer the early error in the backend.

Copy link
Collaborator

@sebmarkbage sebmarkbage left a comment

Choose a reason for hiding this comment

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

I think you might end up getting race condition errors so you should probably simplify the tracking or simplify the protocol to go in only one direction (i.e. the only time it's recorded is if it's set to true).

@eps1lon
Copy link
Collaborator Author

eps1lon commented Sep 11, 2025

I simplify the protocol to save on serialisation in a follow-up.

@eps1lon eps1lon force-pushed the sebbie/09-05-_devtools_show_boundaries_with_unique_suspenders_only_by_default_in_the_timeline branch from f4b3b80 to 1643d6a Compare September 11, 2025 09:19
@eps1lon eps1lon merged commit b1c519f into facebook:main Sep 11, 2025
241 checks passed
@eps1lon eps1lon deleted the sebbie/09-05-_devtools_show_boundaries_with_unique_suspenders_only_by_default_in_the_timeline branch September 11, 2025 09:33
github-actions bot pushed a commit to unibus112/react that referenced this pull request Sep 11, 2025
github-actions bot pushed a commit to unibus112/react that referenced this pull request Sep 11, 2025
github-actions bot pushed a commit to code/lib-react that referenced this pull request Sep 13, 2025
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