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
Do you want to request a feature or report a bug?
Bug What is the current behavior?
Create a SimpleSelect component with default value option and createFromSearch option.
When you try to add new option from createFromSearch callback via clicking on new option item - value show the newly added option and the duplicating value. Note: when you add new option item via Enter key - all works fine, no duplicating value.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem:
Select SimpleSelect component and type something to add new option, then click Add <%something%> via mouse.
Demo issue: https://codesandbox.io/s/z244om8rqm
Gif:
What is the expected behavior?
After clicking on Add <%something%> option - input should show value w/o duplicate. Note: Adding new item via Enter key works fine. Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React v15.4.2/16.0.0
Chrome 63.0.3239.84 Win10
The text was updated successfully, but these errors were encountered:
Hey guys, to fix the problem add this property to SimpleSelect:
uid={item => item.value}
I honestly can't read livescript well, so I don't know how exactly react-selectize uses "uid" and why it causes this behaviour. But it fixes the problem.
Documentation says that this should be the default uid, but it's not true. Default uid is "id" function from prelude-ls, which returns the object passed in itself, which is the "item".
To speculate about this, I believe when you submit a new item via "createFromSearch" feature it has "newOption" additional property, which you remove from the item within onValueChange function. Then because of what I described above with "uid", deep equality somewhere fails and causes this buggy behaviour. Making it explicit that uid of an item is just its value fixes the problem.
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
Create a SimpleSelect component with default value option and createFromSearch option.
When you try to add new option from createFromSearch callback via clicking on new option item - value show the newly added option and the duplicating value.
Note: when you add new option item via Enter key - all works fine, no duplicating value.
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem:
Select SimpleSelect component and type something to add new option, then click Add <%something%> via mouse.
Demo issue: https://codesandbox.io/s/z244om8rqm
Gif:
What is the expected behavior?
After clicking on Add <%something%> option - input should show value w/o duplicate.
Note: Adding new item via Enter key works fine.
Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?
React v15.4.2/16.0.0
Chrome 63.0.3239.84 Win10
The text was updated successfully, but these errors were encountered: