dillon1000/react
Commit
Browse files [DevTools] Fix commit index reset when switching profiler roots (#35672)
Fixes https://github.com/facebook/react/issues/31463, https://github.com/facebook/react/issues/30114. When switching between roots in the profiler flamegraph, the commit index was preserved from the previous root. This caused an error "Invalid commit X. There are only Y commits." when the new root had fewer commits than the selected index. This fix resets the commit index to 0 (or null if no commits) when the commitData changes, which happens when switching roots.
Changed paths2 files
First-parent comparisonpackages/react-devtools-shared/src/__tests__/profilerContext-test.js ModifiedM packages/react-devtools-shared/src/devtools/views/Profiler/useCommitFilteringAndNavigation.js ModifiedPatch
Files changed
Rendering syntax-highlighted changes…