osstotalsoft / rocket-ui-ts

A collection of reusable and composable React components written in TypeScript built on top of Material UI Core V5
MIT License
19 stars 4 forks source link

Wrong primitive new option with creatable Autocomplete and empty default options #103

Open alexandra-c opened 10 months ago

alexandra-c commented 10 months ago

Latest version

Current behavior

Having an Autocomplete with creatable and primitive options, if the options are empty and we wish to create a new one, the newly created option will not be a primitive but an object by default. {"id": "x", "name": "x"} instead of 'x'

Expected behavior

The newly created option should be a primitive as expected in our case. We might need a way to differentiate an Autocomplete with primitive options and one with object options. Also, the "simpleValue" functionality seem redundant, we should only keep primitive functionality and remove "simpleValue".

see branch for failing test describing the issue https://github.com/osstotalsoft/rocket-ui-ts/tree/bug/creatable-autocomplete-primitive image