-
Notifications
You must be signed in to change notification settings - Fork 36
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
fix: allow object options to share the same label #217
Conversation
I thought keys have to be primitive types? |
Ah, I was wrong. From the Svelte docs:
|
Svelte uses a Edit: ahahah you were faster |
Maybe we should still default to the option label as key but allow overriding this behavior by exposing a new prop |
That's a an option too, but having two different values with the same name would still break svelte-multiselect |
That's true but that was by design (until now anyway). Maybe it's not a good default. I think I made that decision at the time because I couldn't think of a strong use case for duplicate options. That was before allowing user-created options. But even now, maybe it's better to show a warning to users rather than allowing them to make duplicate options? |
That's right, shall I update this PR with a new The only thing that might break with the current PR is https://svelte.dev/repl/60e7b5893b304b8f9e0ea094fe6bb293?version=3.57.0 (just updated the repl with both kind of copies) |
I didn't realize the downside was this small. Nice REPL btw. Very educational.
No, I'm sold. I think we should just add a test that covers selecting two identical object options. |
Thanks for the quick merge! |
Closes #216
Keys can be objects, though somewhat discouraged.