refac: dedup tags

This commit is contained in:
Timothy Jaeryang Baek 2025-11-04 23:44:33 -05:00
parent cde4b93fa6
commit 314cac0113

View file

@ -121,7 +121,10 @@
if (selectedTag === '') {
return true;
}
return (item.model?.tags ?? []).map((tag) => tag.name).includes(selectedTag);
return (item.model?.tags ?? [])
.map((tag) => tag.name.toLowerCase())
.includes(selectedTag.toLowerCase());
})
.filter((item) => {
if (selectedConnectionType === '') {
@ -139,7 +142,9 @@
if (selectedTag === '') {
return true;
}
return (item.model?.tags ?? []).map((tag) => tag.name).includes(selectedTag);
return (item.model?.tags ?? [])
.map((tag) => tag.name.toLowerCase())
.includes(selectedTag.toLowerCase());
})
.filter((item) => {
if (selectedConnectionType === '') {
@ -315,7 +320,7 @@
tags = items
.filter((item) => !(item.model?.info?.meta?.hidden ?? false))
.flatMap((item) => item.model?.tags ?? [])
.map((tag) => tag.name);
.map((tag) => tag.name.toLowerCase());
// Remove duplicates and sort
tags = Array.from(new Set(tags)).sort((a, b) => a.localeCompare(b));
}