Repository navigation
fix(registry): caption components group a replaced transcript instead of crashing - #7690
Open
wonjangcloud9 wants to merge 2 commits into
Open
wonjangcloud9 wants to merge 2 commits into
wonjangcloud9 wants to merge 2 commits into
Conversation
… of crashing caption-highlight, caption-clip-wipe and caption-particle-burst grouped their words with hand-written index ranges ([0,3] ... [25,27]) tuned for the 28-word demo transcript. Replacing WORDS with a shorter one, as their install snippet invites, read WORDS[16].start of undefined and the whole caption track disappeared (page_error "Cannot read properties of undefined (reading 'start')"). The hand-tuned ranges now apply only when they cover WORDS exactly; any other transcript is grouped by the buildGroups function caption-glitch-rgb already uses. The demo renders byte-identical frames. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
miguel-heygen
approved these changes
Nov 14, 2026
miguel-heygen
left a comment
Collaborator
There was a problem hiding this comment.
Verified at 5645e9b: the bug reproduces on main, and the new tests fail without the fix and pass with it. Required CI is green.
miguel-heygen
enabled auto-merge
November 14, 2026 03:48
…egex Parse the component with script execution disabled and take the inline script from the parsed <script> elements, so the test no longer strips tags with a regex (CodeQL js/bad-tag-filter, js/incomplete-multi-character-sanitization).
Contributor
Author
|
Thanks again for the CodeQL fix in |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
caption-highlight,caption-clip-wipeandcaption-particle-burstno longer crash when you replace theirWORDSwith your own transcript. Their hand-tuned word groups are kept for the demo transcript (frames are byte-identical), and any other transcript is grouped by the samebuildGroupsthatcaption-glitch-rgbalready uses.Why
The three components group words with a hard-coded list of index ranges tuned for the 28-word demo:
hyperframes add caption-highlightprints "paste from compositions/components/caption-highlight.html into your composition", and the obvious edit is to swapWORDSfor your transcript. With a 15-word Korean transcript,WORDS[16]is undefined and the script throws before registering its timeline:and the snapshot shows no captions at all. A longer transcript fails differently: words past index 27 are silently never shown.
Related work
No existing issue or PR on the index ranges. #2107 lists the caption components for unrelated reasons (placeholder
<video>, contrast warnings); #6792 fixed their last-group end time and is unaffected.How
In each of the three files:
Everything below
RAW_GROUPSis untouched.buildGroupsbreaks after sentence punctuation, a gap over 0.28 s, 4 words or ~21 characters, so it is not a byte-for-byte match for the hand-tuned demo grouping, which is why the demo keeps its own ranges.Derived catalog files (
docs/catalog/components/*.mdx, payloads) are left for the publish PR;bun run check:catalog-driftreports "Catalog sources generate successfully".Not changed:
caption-clip-wipeandcaption-particle-burstalso keep aKEYWORDSset of demo word indices for their accent styling. With another transcript it accents whichever words sit at those indices; that is cosmetic and does not throw, so I left it out of this fix.Test plan
packages/cli/src/registry/captionWordGroups.test.ts(plain unit test; happy-dom DOM + a no-op GSAP timeline, runs the component's own inline script): for each of the three components, (1) the demo transcript still yields group sizes[4,4,1,4,3,1,3,3,2,3], (2) a 15-word Korean transcript runs without throwing and every word lands in a group. On main's components (2) fails 3/3 withTypeError: Cannot read properties of undefined (reading 'start'); with the fix 6/6 pass.src/registry/unit tests 269 passed;captionLastGroup.chromium.test.tspasses.caption-highlightmounted andWORDSswapped for 15 Korean words: main →checkexit 1,console_error … reading 'start', snapshot at 1 / 3.2 / 6.6 s shows no captions; fixed component →checkexit 0 (ok: true, onlyaudio_noneinfo), snapshot shows오늘은 정말 특별한 날이에요./우리가 함께 만든 영상을/끝까지 봐 주세요.with the highlight sweep.🤖 Generated with Claude Code