Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Pills Container component tries to access a property of undefined (runtime major crash) #3138

Open
VladimirParmonD opened this issue Feb 12, 2024 · 2 comments

Comments

@VladimirParmonD
Copy link

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
image
image

Copy link

welcome bot commented Feb 12, 2024

Thanks for opening your first issue! 👋
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.

@PushpakB3096
Copy link

I can work on this if no one has picked it yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants