I am using selection tags to filter my gallery. Currently, this works as intended - however, I would like it to be only possible to select one tag at a time (so when a tag is selected it filters the options associated with that tag, but when another tag is clicked, it resets the old tag and only shows the new filter options for that one) I hope this makes sense.
I found an example of this working here: https://payment37.wixsite.com/candytunes
and my code for my site is here:

Please help me!
@robbiektc I’ve done this several different ways, but I found that using the JS reverse function to be simplest and most efficient way to handle it:
$w("#selectionTags1").value = [$w("#selectionTags1").value.reverse()[0]];
Thank you for your reply!
I had some more help and eventually got to this, which works perfectly!
For anyone else wanting to use this - Just have to change the #SELECTIONTAGSID , #FIELDKEY and #DATASETID to match your own.
import wixData from 'wix-data';
$w.onReady(function () {
$w('#SELECTIONTAGSID').onChange(() => {
let selectedTag = $w('#SELECTIONTAGSID').value;
for (var i = 0; i < selectedTag.length - 1; i++) {
if (selectedTag.length > 1) {
selectedTag.shift();
}
}
setTimeout(() => {
$w('#SELECTIONTAGSID').value = [];
$w('#SELECTIONTAGSID').value = selectedTag;
}, 1)
let filter = wixData.filter();
if (selectedTag.length > 0) {
filter = filter.hasSome("#FIELDKEY", selectedTag);
}
$w('#DATASETID').setFilter(filter);
});
});