[DevTools] Check suspense child node presence in parentSuspense.children before removing (#35775)
Currently, this silently removes the last child in the list, which doesn't contain the `id`.
Ruslan Lesiutin committed
Feb 13, 2026 at 15:33 UTC
03ca38e6e7b84cf20438c1d333636b3d662ca726
1 file changed
+7
packages/react-devtools-shared/src/devtools/store.js
+7
@@ -1873,6 +1873,13 @@ export default class Store extends EventEmitter<{
1873
}
1874
1875
const index = parentSuspense.children.indexOf(id);
1876
+ if (index === -1) {
1877
+ this._throwAndEmitError(
1878
+ Error(
1879
+ `Cannot remove suspense node "${id}" from parent "${parentID}" because it is not a child of the parent.`,
1880
+ ),
1881
+ );
1882
+ }
1883
parentSuspense.children.splice(index, 1);
1884
}
1885
}