bvaughn/react-devtools-experimental

Clear profiling data for root when the root is unmounted

bvaughn opened this issue · 0 comments

See PR #230

We currently only reset profiling data when profiling is re-started (in onProfilingStatus)

onProfilingStatus = (isProfiling: boolean) => {
if (isProfiling) {
this._importedProfilingData = null;
this._profilingOperations = new Map();
this._profilingScreenshots = new Map();
this._profilingSnapshot = new Map();
this.roots.forEach(this._takeProfilingSnapshotRecursive);
}

We should probably also clear it out if the root it corresponds to gets unmounted.

This should be easy for _profilingOperations and _profilingSnapshot since they are just maps of root ID to data.

However, I think _profilingScreenshots is actually currently broken because it maps commit index to screenshot, rather than root id to commit index to screenshot. So we should fix that too!

A basic test or two that verifies this would be nicer. 😄