-
Notifications
You must be signed in to change notification settings - Fork 49.6k
[DevTools] Only show boundaries with unique suspenders by default in the timeline #34397
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
d57a481 to
641632b
Compare
packages/react-devtools-shared/src/devtools/views/SuspenseTab/SuspenseTimeline.js
Outdated
Show resolved
Hide resolved
641632b to
91a6b6f
Compare
aba8c15 to
68caa3b
Compare
654b688 to
f4b3b80
Compare
| operations[i++] = SUSPENSE_TREE_OPERATION_SUSPENDERS; | ||
| operations[i++] = numSuspenderChanges; | ||
| pendingSuspenderChanges.forEach(fiberIdWithChanges => { | ||
| const suspense = idToSuspenseNodeMap.get(fiberIdWithChanges); |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this 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).
|
I simplify the protocol to save on serialisation in a follow-up. |
f4b3b80 to
1643d6a
Compare
…the timeline (facebook#34397) DiffTrain build for [b1c519f](facebook@b1c519f)
…the timeline (facebook#34397) DiffTrain build for [b1c519f](facebook@b1c519f)
…the timeline (facebook#34397) DiffTrain build for [b1c519f](facebook@b1c519f)
…the timeline (facebook#34397) DiffTrain build for [b1c519f](facebook@b1c519f)
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