-
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
Don't return null if the last item is manually removed #4117
Conversation
Fixes the `Invalid attempt to spread non-iterable instance` which occurs when items are removed from the input one by one.
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 21ede43:
|
Thanks @Mecit! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work. Perhaps you can add one small fix as well while this is open.
Can you add the following after line 34: (or something equivalent)
if (value.find(val => val && val.value === inputValue)) return;
There is another bug present in this example if you try to add a duplicate word.
@Mecit Seems like ESLint is failing. Perhaps it doesn't like the |
@Methuselah96 Yes, it seems ESLint 7.2.0 is needed for the nullish coalescing feature. If upgrading the package would be too bothersome, we can consider using || instead. |
@Mecit It's probably easier to go with |
@Methuselah96 no problem. I'm aware my commit was a quick fix to the problem and I'm glad the underlying issue was resolved in a more convenient way. |
Fixes the
Invalid attempt to spread non-iterable instance
which occurs when items are removed from the input one by one.