Skip to content

Fix multiple value for select#2385

Open
schilchSICKAG wants to merge 1 commit intoshoelace-style:nextfrom
schilchSICKAG:fix/harden-select-value-multiple
Open

Fix multiple value for select#2385
schilchSICKAG wants to merge 1 commit intoshoelace-style:nextfrom
schilchSICKAG:fix/harden-select-value-multiple

Conversation

@schilchSICKAG
Copy link
Contributor

Fixes #2384

@vercel
Copy link

vercel bot commented Feb 21, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
shoelace ✅ Ready (Inspect) Visit Preview Feb 21, 2025 9:11am

if (this.multiple) {
val = Array.isArray(val) ? val : val.split(' ');
if (!Array.isArray(val)) {
val = typeof val === 'string' ? val.split(' ') : [val].filter(Boolean);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we filtering here? While this removes empty values, wouldn't it also remove '0' and other falsey values that might be intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply, I was on vacation. You are right, this should just filter out things like 'false' or 'undefined', but certainly not '0'. Will update this and rerequest a review 👍

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

Successfully merging this pull request may close these issues.

sl-select breaks when value is set to a non string value and multiple is set

2 participants