dillon1000/react

Commit

[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.
Browse files
Changed paths2 files
First-parent comparison
M packages/react-devtools-shared/src/__tests__/profilerContext-test.js ModifiedM packages/react-devtools-shared/src/devtools/views/Profiler/useCommitFilteringAndNavigation.js Modified
Patch

Files changed

Rendering syntax-highlighted changes…