From 7b406d62290cfee1deddbdcf0a9313953dd826fa Mon Sep 17 00:00:00 2001 From: phix Date: Wed, 17 Apr 2024 10:39:32 -0700 Subject: [PATCH] Fixing multi tag change. --- web/src/components/datasets/DatasetTags.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/web/src/components/datasets/DatasetTags.tsx b/web/src/components/datasets/DatasetTags.tsx index 0a3546d842..3171e8f528 100644 --- a/web/src/components/datasets/DatasetTags.tsx +++ b/web/src/components/datasets/DatasetTags.tsx @@ -103,11 +103,17 @@ const DatasetTags: React.FC = (props) => { _reason: AutocompleteChangeReason, details?: AutocompleteChangeDetails | 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)