[DevTools] Fix crash on reorder operation mismatch#259
Conversation
Greptile OverviewGreptile SummaryThis PR fixes a crash in React DevTools that occurred when frontend and backend got out of sync regarding children lists during reorder operations (e.g., when duplicate keys exist). The fix replaces error-throwing behavior with a graceful bailout that logs a warning and safely skips the malformed operation. Key Changes:
The implementation correctly handles the operation stream by advancing the index past the child IDs before breaking, preventing cascading failures from operation desynchronization. Confidence Score: 4/5
Important Files ChangedFile Analysis
|
There was a problem hiding this comment.
Additional Comments (1)
-
packages/react-devtools-shared/src/devtools/store.js, line 1937-1943 (link)style: same issue could occur for Suspense nodes - consider applying the same graceful bailout logic here as was done for regular elements in
TREE_OPERATION_REORDER_CHILDRENNote: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
2 files reviewed, 1 comment
|
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#35376
Original author: shash-hq
Debugged a crash where Store throws "Children cannot be added or removed..." during a reorder op.
It seems to happen when the frontend and backend get out of sync regarding the children list (e.g. duplicate keys).
This PR adds a guard in onBridgeOperations. If the operation implies a child count that mismatches the store's state, it now warns and safely skips the operation instructions instead of blowing up the whole DevTools UI.
Added a regression test case to verify the bailout logic.
Fixes #35360