@samitouri / QOS-React-2 / commits / fbd82385d2

Fixed a state cleanup issue if Profiler data is cleared

Brian Vaughn committed May 22, 2019 at 09:04 UTC fbd82385d2398bfa306fc790aa7645be56bce906
2 files changed +18 -15
src/devtools/ProfilerStore.js
+2 -1
@@ -153,12 +153,13 @@ export default class ProfilerStore extends EventEmitter {
153 this._initialSnapshotsByRootID.clear();
154 this._inProgressOperationsByRootID.clear();
155 this._inProgressScreenshotsByRootID.clear();
156 + this._rendererQueue.clear();
157
158 // Invalidate suspense cache if profiling data is being (re-)recorded.
159 // Note that we clear now because any existing data is "stale".
160 this._cache.invalidate();
161
161 - this.emit('isProfiling');
162 + this.emit('profilingData');
163 }
164
165 startProfiling(): void {
src/devtools/views/Profiler/Profiler.js
+16 -14
@@ -63,20 +63,22 @@ function Profiler({ supportsProfiling }: Props) {
63 }
64
65 let sidebar = null;
66 - switch (selectedTabID) {
67 - case 'interactions':
68 - sidebar = <SidebarInteractions />;
69 - break;
70 - case 'flame-chart':
71 - case 'ranked-chart':
72 - if (selectedFiberID !== null) {
73 - sidebar = <SidebarSelectedFiberInfo />;
74 - } else {
75 - sidebar = <SidebarCommitInfo />;
76 - }
77 - break;
78 - default:
79 - break;
66 + if (!isProfiling && !isProcessingData && hasProfilingData) {
67 + switch (selectedTabID) {
68 + case 'interactions':
69 + sidebar = <SidebarInteractions />;
70 + break;
71 + case 'flame-chart':
72 + case 'ranked-chart':
73 + if (selectedFiberID !== null) {
74 + sidebar = <SidebarSelectedFiberInfo />;
75 + } else {
76 + sidebar = <SidebarCommitInfo />;
77 + }
78 + break;
79 + default:
80 + break;
81 + }
82 }
83
84 return (