hailey/filter dupe labels (#5984)

This commit is contained in:
Hailey
2024-10-28 16:23:38 -07:00
committed by GitHub
parent 93a53162e8
commit bdb5722640
+6 -2
View File
@@ -34,13 +34,17 @@ export function LabelsBtn({
const updateAdultLabels = (newLabels: AdultSelfLabel[]) => {
const newLabel = newLabels[newLabels.length - 1]
const filtered = labels.filter(l => !ADULT_CONTENT_LABELS.includes(l))
onChange([...filtered, newLabel].filter(Boolean) as SelfLabel[])
onChange([
...new Set([...filtered, newLabel].filter(Boolean) as SelfLabel[]),
])
}
const updateOtherLabels = (newLabels: OtherSelfLabel[]) => {
const newLabel = newLabels[newLabels.length - 1]
const filtered = labels.filter(l => !OTHER_SELF_LABELS.includes(l))
onChange([...filtered, newLabel].filter(Boolean) as SelfLabel[])
onChange([
...new Set([...filtered, newLabel].filter(Boolean) as SelfLabel[]),
])
}
return (