You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When creating a svelecte component with the creatable and keepCreated flags set, the newly created option is not displayed correctly in the options array on screen, it reads [Object] [Object].
I went into the code and pinpointed the area of the error and then fixed it, it was quite simple actually. On line 421 of the Svelecte.svelte file in the selectOption function (the line: if (keepCreated) options = [...options, opt];), the correct line should be: if (keepCreated) options = [...options, opt.value];. Instead of using the spread operator to add "opt" to the options array it should be "opt.value", remember that it is not a string but an object.
I didn't know how to address this in a pull request, but I hope this is also clear and you can fix it soon. It is resolved now in my code, but the next time I pull code from your repo the issue will be there again unless it is fixed. Greetings from the Netherlands.
The text was updated successfully, but these errors were encountered:
Yes that is correct, the options array is filled with objects, however, when pushing to that array from the line on 241 it pushes an object to the value field in the new object in the options array. So the options array ends up looking someting like [{value: {value: "value", label: "label"}, label: "label"}], while you would expect: [{value: "value", label: "label"}].
I am also not sure what the svelte REPL is, sorry.
When creating a svelecte component with the creatable and keepCreated flags set, the newly created option is not displayed correctly in the options array on screen, it reads [Object] [Object].
I went into the code and pinpointed the area of the error and then fixed it, it was quite simple actually. On line 421 of the Svelecte.svelte file in the selectOption function (the line: if (keepCreated) options = [...options, opt];), the correct line should be: if (keepCreated) options = [...options, opt.value];. Instead of using the spread operator to add "opt" to the options array it should be "opt.value", remember that it is not a string but an object.
I didn't know how to address this in a pull request, but I hope this is also clear and you can fix it soon. It is resolved now in my code, but the next time I pull code from your repo the issue will be there again unless it is fixed. Greetings from the Netherlands.
The text was updated successfully, but these errors were encountered: