The problem is that the Options have to be opened at least once before their data is populated in the Context. This means that if a value or defaultValue is passed to the Select we won't have the option data yet (i.e. if an option has value and label we won't have the label yet).
I had the same issue previously when I was trying to make use of the fact that headless UI Listbox supports complex objects as value.
I think the proper solution to this might be that we have to change the API of the Select component such that in addition to accepting strings it also accepts complex objects as value or defaultValue.
The problem is that the Options have to be opened at least once before their data is populated in the Context. This means that if a
value
ordefaultValue
is passed to the Select we won't have the option data yet (i.e. if an option has value and label we won't have the label yet).I had the same issue previously when I was trying to make use of the fact that headless UI Listbox supports complex objects as value.
I think the proper solution to this might be that we have to change the API of the Select component such that in addition to accepting strings it also accepts complex objects as
value
ordefaultValue
.