Skip to content

Commit 5af6203

Browse files
committed
fix(caption-weight-shift): remove O(n^2) redundant hide-all-others loop
1 parent 18de2b1 commit 5af6203

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

‎registry/components/caption-weight-shift/caption-weight-shift.html‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -529,9 +529,13 @@
529529
var visibleEnd =
530530
groupIndex < GROUPS.length - 1 ? visibleStarts[groupIndex + 1] : DURATION;
531531

532-
allGroupEls.forEach(function (otherEl, otherIndex) {
533-
if (otherIndex !== groupIndex) tl.set(otherEl, { opacity: 0 }, visibleStart);
534-
});
532+
// Each group already owns its full opacity lifecycle (set 0 at its
533+
// own visibleStart, animated to 1, then set back to 0 at its own
534+
// visibleEnd below), and groups occupy non-overlapping windows, so
535+
// explicitly hiding every OTHER group here was redundant and made
536+
// timeline construction O(groups^2) — this collapsed under dense
537+
// stress transcripts (many short groups). Removed; behavior is
538+
// unchanged (verified against templates.test.ts).
535539

536540
tl.set(groupEl, { opacity: 0, scale: 0.85 }, visibleStart);
537541
tl.to(

0 commit comments

Comments
 (0)