SIGN IN SIGN UP

[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.
R
Ruslan Lesiutin committed
5dad2b47b87d93db51f3bd41453a39124127b75d
Parent: 748ee74
Committed by GitHub <noreply@github.com> on 2/3/2026, 12:44:04 PM