-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Inconsistent behaviour on remove last item (vs remove all items) #4247
Comments
Duplicate of two issues:
|
Related #4252 |
Documentation Issue is a duplicate of #4190 |
Closing this as the example and behavior have been fixed. Related: #4373 |
So what is the simple answer? is removing all-items and removing last-item now setting the value to
All the related issues have got me so confused. |
@joe-oli I don't know in which issue I have read it, but the answer – as I understood it – is |
Ha, it's here: #4293 (comment)
|
In a recent call with Jed, Nathan, and Thomas, the argument was made that Therefore in v3.2, the fix was made for consistency to return null when removing the last value to avoid breaking changes, In v4, this will likely be reversed such that a multi with no value returns empty array instead. Hope this is clears things up. Did you have any other questions or concerns regarding this approach? |
Thank you, no more questions now that it is clear what to expect. |
Are you asking a question?
No.
Are you reporting a bug or runtime error?
An error in your example, a runtime error, and a bug.
An error in your example in this page:
https://react-select.com/creatable
Specifically Multi-select text input and the method handleKeyDown;
The line
value: [...value, createOption(inputValue)],
assumes ...value is always an array; this is NOT true;
value becomes null when you remove the last item, by clicking on the individual item;
Herein lies the bug: Inconsistent behaviour when removing the last item.
When removing an individual last item (click on small-x), value = null;
When removing all items (click on big-x), value = [];
Are you making a feature request?
No. it is a bug fix.
Please make the behavior consistent on item removal, so that even your own example works.
The text was updated successfully, but these errors were encountered: