Skip to content

Write HTML. Render video. Built for agents.

fix(caption-weight-shift): remove O(n^2) redundant hide-all-others loop

vanceingalls5af6203ae7fc
diff --git a/registry/components/caption-weight-shift/caption-weight-shift.html b/registry/components/caption-weight-shift/caption-weight-shift.html
index 2ead4d717f..873182ea57 100644
--- a/registry/components/caption-weight-shift/caption-weight-shift.html
+++ b/registry/components/caption-weight-shift/caption-weight-shift.html
@@ -529,9 +529,13 @@
var visibleEnd =
groupIndex < GROUPS.length - 1 ? visibleStarts[groupIndex + 1] : DURATION;
- allGroupEls.forEach(function (otherEl, otherIndex) {
- if (otherIndex !== groupIndex) tl.set(otherEl, { opacity: 0 }, visibleStart);
- });
+ // Each group already owns its full opacity lifecycle (set 0 at its
+ // own visibleStart, animated to 1, then set back to 0 at its own
+ // visibleEnd below), and groups occupy non-overlapping windows, so
+ // explicitly hiding every OTHER group here was redundant and made
+ // timeline construction O(groups^2) — this collapsed under dense
+ // stress transcripts (many short groups). Removed; behavior is
+ // unchanged (verified against templates.test.ts).
tl.set(groupEl, { opacity: 0, scale: 0.85 }, visibleStart);
tl.to(