What is the expected behavior?
Tag with value 0 is selectable
What is happening instead?
Tag with value 0 is not selectable (see the demo page for demonstration)
What error message are you getting?
No error message
Additional details: after a brief debug session the issue looks to be in the normalizeTags method during evaluating of isCollection variable:
isCollection = isArray && tagsItems[0].value,
In this case when value is not 0 the variable is evaluated as true, whereas if it's 0 it is evaluated as false.
Possible solution: check for value 0 specifically.
Prerequisites
💥 Demo Page
React issue template: https://codesandbox.io/s/tagify-react-issue-template-forked-fs8fk4?file=/src/index.js
Explanation
What is the expected behavior? Tag with value 0 is selectable
What is happening instead? Tag with value 0 is not selectable (see the demo page for demonstration)
What error message are you getting? No error message
Additional details: after a brief debug session the issue looks to be in the normalizeTags method during evaluating of isCollection variable:
isCollection = isArray && tagsItems[0].value,
In this case when value is not 0 the variable is evaluated as true, whereas if it's 0 it is evaluated as false. Possible solution: check for value 0 specifically.