diff --git a/src/devtools/views/Profiler/ProfilerContext.js b/src/devtools/views/Profiler/ProfilerContext.js index 490db544c8..d6d0a96a4f 100644 --- a/src/devtools/views/Profiler/ProfilerContext.js +++ b/src/devtools/views/Profiler/ProfilerContext.js @@ -124,6 +124,15 @@ function ProfilerContextController({ children }: Props) { const [selectedFiberID, selectFiber] = useState(null); + if (isProfiling) { + if (selectedFiberID !== null) { + selectFiber(null); + } + if (selectedCommitIndex !== null) { + setSelectedCommitIndex(null); + } + } + const value = useMemo( () => ({ hasProfilingData, diff --git a/src/devtools/views/Profiler/SnapshotSelector.js b/src/devtools/views/Profiler/SnapshotSelector.js index fa6469b54e..ff4abdf4ae 100644 --- a/src/devtools/views/Profiler/SnapshotSelector.js +++ b/src/devtools/views/Profiler/SnapshotSelector.js @@ -56,7 +56,8 @@ export default function SnapshotSelector(_: Props) { }, [filteredCommitIndices, selectedCommitIndex]); // TODO (profiling) This should be managed by the context controller (reducer). - // TODO (profiling) We should also reset the selected index to 0 between profiling sessions. + // It doesn't currently know about the filtered commits though (since it doesn't suspend). + // Maybe this component should pass filteredCommitIndices up? if (selectedFilteredCommitIndex === null) { if (numFilteredCommits > 0) { setSelectedCommitIndex(0);