-
Notifications
You must be signed in to change notification settings - Fork 188
missing generic implementation in select file #72
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
Conversation
This solution doesn't seem quite right. I think we need some more tests for isCreatable and make sure we are handling all scenarios. There is a function that is used for creating new items, we could probably use that to create the creator item as well. @rob-balfre what are your thoughts? |
@Taha-Firoz thanks for the PR! You're right it shouldn't show undefined but your change causes a test to fail. @subpx's suggestion is prob a better approach that doesn't cause breaking changes. |
@rob-balfre With that solution you could never have multiple items created by the same filter text. |
@rob-balfre I really don't understand that solution since the createItem function I'm using doesn't have any field called @subpx I didn't know svelte-select even allowed multiple items to be added by the same filter text. Could you explain on how I can make this fix without failing the tests? |
@Taha-Firoz can you make a REPL of how you're trying to use svelte-select please? You can use this one as a base... https://svelte.dev/repl/f3bc0fd6b6f74ea499e5ecb26911bf28?version=3.6.8 |
@rob-balfre https://svelte.dev/repl/ba5d877d743545f28ea9b1b1e4e23dea?version=3.6.8 |
@rob-balfre I was thinking of exactly that, adding a label identifier but dismissed the idea and just tried to make do with whatever existed already. Should I close the PR now? |
@rob-balfre This is not going to work when using getOptionLabel |
@subpx I updated getOptionLabel too (see the changes/tests). Should be backwards compatible too. Unless I'm missing something? |
@rob-balfre Ive still got a breaking test. Give me bit and I will do a push. |
@subpx thanks, yeah thats pretty crappy. hmmm short of refactoring isCreatable not sure of a work around. |
@rob-balfre should be pretty straight forward without getCreateLabel. I say we remove that. |
@subpx worked his magic. @Taha-Firoz here ya go https://svelte.dev/repl/db8ab7241f5946ee922100bfec33cb1c?version=3.9.0 Gonna close this PR now. |
I was having issues when I had a custom
optionIdentifier
paired withisMulti
&isCreatable
. I am using it as a tag input solution in my project and whenever I added a new input it wouldn't show the default create message, it would show undefined. I tracked down the issue to be in the Select file, it wasn't appending the generic optionIdentifier in the_filteredItems
array it was appending specificallylabel
. I changedlabel:
our foroptionIdentifier
and everything started to work.The library is great since the combination fo svelte and bulma doesn't give us many choices in input fields and yours is very ergonomic.