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

getControlItem.options.map is not a function due to missing Array.isArray check #3

Open
aman9039 opened this issue Dec 29, 2024 · 1 comment

Comments

@aman9039
Copy link

The error occurs because getControlItem.options is being accessed with .map() directly, without validating if it is an array. If getControlItem.options is undefined, null, or not an array, a TypeError: getControlItem.options.map is not a function will be thrown.

fix: {getControlItem.options && Array.isArray(getControlItem.options) && getControlItem.options.length > 0
? getControlItem.options.map((optionItem) => (

{optionItem.label}

))
: null}

@abhinav234799
Copy link

where should we add that

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