fix duplicate labels

This commit is contained in:
Hongbo Wu 2023-12-29 16:36:55 +08:00
parent cbb07318e5
commit 7153014a87

View file

@ -979,10 +979,11 @@ export const batchUpdateLibraryItems = async (
.map((label) => ({
labelId: label.id,
libraryItemId: libraryItem.id,
name: label.name,
}))
.filter((entityLabel) => {
const existingLabel = libraryItem.labels?.find(
(l) => l.id === entityLabel.labelId
const existingLabel = libraryItem.labelNames?.find(
(l) => l.toLowerCase() === entityLabel.name.toLowerCase()
)
return !existingLabel
})