design-system-react
design-system-react copied to clipboard
The Pills Container component tries to access a property of undefined (runtime major crash)
Error summary: the Pills Component causes a major crash / runtime error
Where the error occurs: design-system-react\components\pill-container\private\selected-listbox.jsx at line 149, function getIcon
Error description: The function getIcon (pic 1) seems to handle the icon display for the currently selected option. Option === current selection, which legitimately can be undefined according to the component props (pic 2). The code tries to access the property option.icon and this results in an error "Cannot access property icon of undefined"
Proposed solution: since both selection and icon are optional props (pic 2), either change the props typings OR use optional chaining (?.) operator in the code. From the looks of it, the latter is preferable since the code handles the possible undefined everywhere except this one place. Seems like just a simple oversight but causes a big trouble in the app
Thanks for opening your first issue! :wave: If you have found this library helpful, please star it. A maintainer will try to respond within 7 days. If you haven’t heard anything by then, please bump this thread.
I can work on this if no one has picked it yet.