Skip to content

Commit 26e6f41

Browse files
committed
fix: add deduplication logic in tree sprite generation
1 parent 67b1322 commit 26e6f41

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

scripts/generate-file-tree-sprite.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,14 @@ async function loadCollections() {
3232

3333
function groupByCollection(iconNames: string[]) {
3434
const grouped: { [key: string]: string[] } = {}
35+
const seen = new Set<string>()
36+
3537
for (const name of iconNames) {
3638
const [, group, iconName] = name.match(COLLECTION_REGEXP) || []
3739
if (group && iconName) {
40+
const key = `${group}-${iconName}`
41+
if (seen.has(key)) continue
42+
seen.add(key)
3843
grouped[group] ||= []
3944
grouped[group].push(iconName)
4045
}

0 commit comments

Comments
 (0)