Only clear Profiling snapshot on root-unmount

This commit is contained in:
Brian Vaughn
2019-05-03 10:12:45 -07:00
parent 73cf0fa32b
commit a552b7b5f7
+7 -7
View File
@@ -921,13 +921,6 @@ export default class Store extends EventEmitter {
throw new Error(`Node ${id} was removed before its children.`);
}
// The following call depends on `getElementByID`
// which depends on the element being in `_idToElement`,
// so we have to do it before removing the element from `_idToElement`.
this._clearProfilingSnapshotRecursive(id);
this._idToElement.delete(id);
let parentElement = null;
if (parentID === 0) {
if (__DEBUG__) {
@@ -941,6 +934,11 @@ export default class Store extends EventEmitter {
this._profilingOperationsByRootID.delete(id);
this._profilingScreenshotsByRootID.delete(id);
// The following call depends on `getElementByID`
// which depends on the element being in `_idToElement`,
// so we have to do it before removing the element from `_idToElement`.
this._clearProfilingSnapshotRecursive(id);
haveRootsChanged = true;
} else {
if (__DEBUG__) {
@@ -956,6 +954,8 @@ export default class Store extends EventEmitter {
parentElement.children.splice(index, 1);
}
this._idToElement.delete(id);
this._adjustParentTreeWeight(parentElement, -weight);
removedElementIDs.set(id, parentID);