designsystemet
designsystemet copied to clipboard
Combobox: null, undefined and empty string as value causes react to crash
Description of the bug
As mentioned in slack thread message: https://designsystemet.slack.com/archives/C05RF86A3K7/p1709550064585419?thread_ts=1709549317.707409&cid=C05RF86A3K7
The value of the generated Option
object will be undefined if any of the mentioned values are used as a value. The object should be checked for undefined before it is attempted to retrieve the objects value property in order to mitigate a hard crash.
Steps To Reproduce
- Set up a simple react app in f.ex. codesandbox
- create a combobox with a controlled state that has initial value
[""]
,[null]
or[undefined]
- the react app will crash
Additional Information
No response