TabGroup's onChange occurs when data list changes
What package within Headless UI are you using?
@headlessui/react
What version of that package are you using?
v2.2.0
What browser are you using?
Arc on Mac
Reproduction URL
https://codesandbox.io/p/devbox/6qfgh2
Describe your issue
Please check the above reproduction URL.
Given assumtion:
spacesare given which will be tab header listspacescould be updated from outsideselectedSpaceIdwill also be given and could be changed from outside
What I wanted:
When I click 'up' or 'down' button to update spaces, I wanted to keep that space focused, just moved the order.
The problem:
even though I didn't updated selectedSpaceId or selectedIndex,
<TabGroup />'s onChange occurs and gives its old selectedIndex.
I think its behavior feels more like defaultSelectedIndex than selectedIndex compared to any other controlled form components from other libraries, (i.e. react's text input component).