mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Reset selected commit and fiber between profiling sessions
This commit is contained in:
@@ -124,6 +124,15 @@ function ProfilerContextController({ children }: Props) {
|
||||
|
||||
const [selectedFiberID, selectFiber] = useState<number | null>(null);
|
||||
|
||||
if (isProfiling) {
|
||||
if (selectedFiberID !== null) {
|
||||
selectFiber(null);
|
||||
}
|
||||
if (selectedCommitIndex !== null) {
|
||||
setSelectedCommitIndex(null);
|
||||
}
|
||||
}
|
||||
|
||||
const value = useMemo(
|
||||
() => ({
|
||||
hasProfilingData,
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user