sapcc / juno

Monorepo for the Juno microfrontend framework, microfrontend apps, design system and component library
Apache License 2.0
5 stars 3 forks source link

[Juno UI] Select refactor: instead of parsing children build pass the information from the SelectOptions to Select via Context #454

Closed edda closed 2 weeks ago

edda commented 8 months ago

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.