You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For a long time I thought this was impossible to do without writing toString/fromString functions for your custom types, but I just realized that you can make it work by instead using the list index of the options as the "value", and then in the onChange decoder use that index to retrieve the item from the passed in options list.
Good solution, thanks for posting. This would require a change to the field type from Field values to Field a values which requires lots of changes all over the place but should be doable.
We may be able to leverage this without an additional type variable by changing the SelectField underlying value from String to Int, finding the index of the selected value in selectField, and turning the update function a -> values -> values into Int -> values -> values with the provided list of options.
For a long time I thought this was impossible to do without writing
toString/fromString
functions for your custom types, but I just realized that you can make it work by instead using the list index of the options as the "value", and then in theonChange
decoder use that index to retrieve the item from the passed in options list.Here's a demo: https://ellie-app.com/7253Q8THR2xa1
The text was updated successfully, but these errors were encountered: