Skip to content

Commit

Permalink
Fixing multi tag change.
Browse files Browse the repository at this point in the history
  • Loading branch information
phix committed Apr 17, 2024
1 parent ed02deb commit 7b406d6
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions web/src/components/datasets/DatasetTags.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,17 @@ const DatasetTags: React.FC<IProps> = (props) => {
_reason: AutocompleteChangeReason,
details?: AutocompleteChangeDetails<string> | undefined
) => {
if (details) {
if (details && _reason === 'removeOption') {
const newTag = details.option
const newSelectedTags = selectedTags.filter((tag) => newTag !== tag)
setSelectedTags(newSelectedTags)
datasetField
? deleteDatasetFieldTag(namespace, datasetName, newTag, datasetField)
: deleteDatasetTag(namespace, datasetName, newTag)
} else if (details && !selectedTags.includes(details.option)) {
const newTag = details.option
const newSelectedTags = [...selectedTags, newTag]
setSelectedTags(newSelectedTags)

datasetField
? addDatasetFieldTag(namespace, datasetName, newTag, datasetField)
: addDatasetTag(namespace, datasetName, newTag)
Expand Down

0 comments on commit 7b406d6

Please sign in to comment.