Don't return null if the last item is manually removed#4117
Don't return null if the last item is manually removed#4117Mecit wants to merge 3 commits intoJedWatson:masterfrom Mecit:patch-1
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! |
ebonow
left a comment
There was a problem hiding this comment.
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 instancewhich occurs when items are removed from the input one by one.