mirror of
https://github.com/facebook/react.git
synced 2026-02-26 02:54:59 +00:00
[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`.
This commit is contained in:
@@ -1873,6 +1873,13 @@ export default class Store extends EventEmitter<{
|
||||
}
|
||||
|
||||
const index = parentSuspense.children.indexOf(id);
|
||||
if (index === -1) {
|
||||
this._throwAndEmitError(
|
||||
Error(
|
||||
`Cannot remove suspense node "${id}" from parent "${parentID}" because it is not a child of the parent.`,
|
||||
),
|
||||
);
|
||||
}
|
||||
parentSuspense.children.splice(index, 1);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user