@@ -1516,7 +1516,7 @@ export function attach(
15161516 currentRoot = rootInstance;
15171517 unmountInstanceRecursively(rootInstance);
15181518 rootToFiberInstanceMap.delete(root);
1519- flushPendingEvents(root );
1519+ flushPendingEvents();
15201520 currentRoot = (null: any);
15211521 });
15221522
@@ -1541,7 +1541,7 @@ export function attach(
15411541 currentRoot = newRoot;
15421542 setRootPseudoKey(currentRoot.id, root.current);
15431543 mountFiberRecursively(root.current, false);
1544- flushPendingEvents(root );
1544+ flushPendingEvents();
15451545 currentRoot = (null: any);
15461546 });
15471547
@@ -2099,7 +2099,7 @@ export function attach(
20992099 }
21002100 }
21012101
2102- function flushPendingEvents(root: Object ): void {
2102+ function flushPendingEvents(): void {
21032103 if (shouldBailoutWithPendingOperations()) {
21042104 // If we aren't profiling, we can just bail out here.
21052105 // No use sending an empty update over the bridge.
@@ -5349,7 +5349,7 @@ export function attach(
53495349
53505350 mountFiberRecursively(root.current, false);
53515351
5352- flushPendingEvents(root );
5352+ flushPendingEvents();
53535353
53545354 needsToFlushComponentLogs = false;
53555355 currentRoot = (null: any);
@@ -5398,7 +5398,7 @@ export function attach(
53985398 rootToFiberInstanceMap.set(root, rootInstance);
53995399 idToDevToolsInstanceMap.set(rootInstance.id, rootInstance);
54005400 } else {
5401- prevFiber = rootInstance.data.alternate ;
5401+ prevFiber = rootInstance.data;
54025402 }
54035403 currentRoot = rootInstance;
54045404
@@ -5452,6 +5452,9 @@ export function attach(
54525452 unmountInstanceRecursively(rootInstance);
54535453 removeRootPseudoKey(currentRoot.id);
54545454 rootToFiberInstanceMap.delete(root);
5455+ } else if (!prevWasMounted && !nextIsMounted) {
5456+ // We don't need this root anymore.
5457+ rootToFiberInstanceMap.delete(root);
54555458 }
54565459
54575460 if (isProfiling && isProfilingSupported) {
@@ -5475,7 +5478,7 @@ export function attach(
54755478 }
54765479
54775480 // We're done here.
5478- flushPendingEvents(root );
5481+ flushPendingEvents();
54795482
54805483 needsToFlushComponentLogs = false;
54815484
0 commit comments