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

Combobox value safety (in case of undefined) #2931

Open
huineng opened this issue Jul 1, 2024 · 1 comment
Open

Combobox value safety (in case of undefined) #2931

huineng opened this issue Jul 1, 2024 · 1 comment

Comments

@huineng
Copy link

huineng commented Jul 1, 2024

I refer to this code

There can be circumstances that value is undefined

If that is the case and the type is multi, it will generate an error (value is not iterable)

I simply suggest to add an if statement

if (value) {
	for (const v of value) {
		for (const item of this.view.getListItems()) {
			if (item[this.itemValueKey] === v) {
				newValues.push(Object.assign({}, item, { selected: true }));
			}
		}
	}
}

"carbon-components-angular": "^5.27.4"

thanks

@yuvraj-proarch
Copy link

I'm also getting console error: value is not iterable

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