Fixed an edge case profiling bug where the number of commits was wrong

This commit is contained in:
Brian Vaughn
2019-04-13 18:29:39 -07:00
parent 7f6fdfea95
commit b76372c93d
+14 -13
View File
@@ -410,24 +410,19 @@ export default class Store extends EventEmitter {
startProfiling(): void {
this._bridge.send('startProfiling');
// Invalidate suspense cache if profiling data is being (re-)recorded.
// Note that we clear now because any existing data is "stale".
this._profilingCache.invalidate();
this._isProfiling = false;
this.emit('isProfiling');
// Don't actually update the local profiling boolean yet!
// Wait for onProfilingStatus() to confirm the status has changed.
// This ensures the frontend and backend are in sync wrt which commits were profiled.
// We do this to avoid mismatches on e.g. CommitTreeBuilder that would cause errors.
}
stopProfiling(): void {
this._bridge.send('stopProfiling');
// Invalidate suspense cache if profiling data is being (re-)recorded.
// Note that we clear again, in case any views read from the cache while profiling.
// (That would have resolved a now-stale value without any profiling data.)
this._profilingCache.invalidate();
this._isProfiling = false;
this.emit('isProfiling');
// Don't actually update the local profiling boolean yet!
// Wait for onProfilingStatus() to confirm the status has changed.
// This ensures the frontend and backend are in sync wrt which commits were profiled.
// We do this to avoid mismatches on e.g. CommitTreeBuilder that would cause errors.
}
toggleIsCollapsed(id: number, isCollapsed: boolean): void {
@@ -812,6 +807,12 @@ export default class Store extends EventEmitter {
if (this._isProfiling !== isProfiling) {
this._isProfiling = isProfiling;
// Invalidate suspense cache if profiling data is being (re-)recorded.
// Note that we clear again, in case any views read from the cache while profiling.
// (That would have resolved a now-stale value without any profiling data.)
this._profilingCache.invalidate();
this.emit('isProfiling');
}
};