Skip to content

Commit d24b011

Browse files
authored
perf: use .some() instead of .filter() for testing filter length (#411)
1 parent 3bf8abe commit d24b011

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

packages/multiple-select-vanilla/src/MultipleSelectInstance.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1588,7 +1588,7 @@ export class MultipleSelectInstance {
15881588
}
15891589
}
15901590

1591-
const noResult = this.data?.filter(row => row.visible).length === 0;
1591+
const noResult = !this.data?.some(row => row.visible);
15921592

15931593
if (this.selectAllElm) {
15941594
this.selectAllElm.ariaChecked = String(this.isAllSelected);
@@ -1882,7 +1882,7 @@ export class MultipleSelectInstance {
18821882
});
18831883
}
18841884
}
1885-
row.visible = (row as OptGroupRowData).children.filter((child: any) => child?.visible).length > 0;
1885+
row.visible = (row as OptGroupRowData).children.some((child: any) => child?.visible);
18861886
}
18871887
} else {
18881888
const rowText = `${(row as OptionRowData)?.text ?? ''}`;

0 commit comments

Comments
 (0)