Skip to content

Commit

Permalink
fix: remove additional tag on click (Greenstand#710)
Browse files Browse the repository at this point in the history
Co-authored-by: Nick Charlton <[email protected]>
  • Loading branch information
OGreeni and nmcharlton authored Jun 28, 2022
1 parent 1f8c84d commit 3bb799b
Show file tree
Hide file tree
Showing 2 changed files with 1,791 additions and 20 deletions.
8 changes: 4 additions & 4 deletions src/components/CaptureTags.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,10 @@ const CaptureTags = (props) => {
tagsContext.setTagInput(tagsContext.tagInput.concat([chip]));
};

const handleDeleteChip = (_chip, index) => {
const handleDeleteChip = (_chip) => {
const temp = tagsContext.tagInput;
temp.splice(index, 1);
tagsContext.setTagInput(temp);
const result = temp.filter((value) => value !== _chip);
tagsContext.setTagInput(result);
};

return (
Expand Down Expand Up @@ -157,7 +157,7 @@ const CaptureTags = (props) => {
value: textFieldInput,
onBeforeAdd: (chip) => handleBeforeAddChip(chip),
onAdd: (chip) => handleAddChip(chip),
onDelete: (chip, index) => handleDeleteChip(chip, index),
onDelete: (chip) => handleDeleteChip(chip),
pattern: TAG_PATTERN,
placeholder: props.placeholder,
}}
Expand Down
Loading

0 comments on commit 3bb799b

Please sign in to comment.