mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
DevTools: Fix memory leak via alternate Fiber pointer (#22346)
This commit is contained in:
@@ -1140,6 +1140,13 @@ export function attach(
|
||||
|
||||
untrackFibersSet.add(fiber);
|
||||
|
||||
// React may detach alternate pointers during unmount;
|
||||
// Since our untracking code is async, we should explicily track the pending alternate here as well.
|
||||
const alternate = fiber.alternate;
|
||||
if (alternate !== null) {
|
||||
untrackFibersSet.add(alternate);
|
||||
}
|
||||
|
||||
if (untrackFibersTimeoutID === null) {
|
||||
untrackFibersTimeoutID = setTimeout(untrackFibers, 1000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user