@samitouri / QOS-React / commits / a552b7b5f7

Only clear Profiling snapshot on root-unmount

Brian Vaughn committed May 3, 2019 at 10:12 UTC a552b7b5f799ef2893d9fd9d5461d569917e4f33
1 file changed +7 -7
src/devtools/store.js
+7 -7
@@ -921,13 +921,6 @@ export default class Store extends EventEmitter {
921 throw new Error(`Node ${id} was removed before its children.`);
922 }
923
924 - // The following call depends on `getElementByID`
925 - // which depends on the element being in `_idToElement`,
926 - // so we have to do it before removing the element from `_idToElement`.
927 - this._clearProfilingSnapshotRecursive(id);
928 -
929 - this._idToElement.delete(id);
930 -
924 let parentElement = null;
925 if (parentID === 0) {
926 if (__DEBUG__) {
@@ -941,6 +934,11 @@ export default class Store extends EventEmitter {
934 this._profilingOperationsByRootID.delete(id);
935 this._profilingScreenshotsByRootID.delete(id);
936
937 + // The following call depends on `getElementByID`
938 + // which depends on the element being in `_idToElement`,
939 + // so we have to do it before removing the element from `_idToElement`.
940 + this._clearProfilingSnapshotRecursive(id);
941 +
942 haveRootsChanged = true;
943 } else {
944 if (__DEBUG__) {
@@ -956,6 +954,8 @@ export default class Store extends EventEmitter {
954 parentElement.children.splice(index, 1);
955 }
956
957 + this._idToElement.delete(id);
958 +
959 this._adjustParentTreeWeight(parentElement, -weight);
960 removedElementIDs.set(id, parentID);
961