diff --git a/packages/core/src/runtime/timeline.test.ts b/packages/core/src/runtime/timeline.test.ts index e6d003eaf2..ab7227bbb7 100644 --- a/packages/core/src/runtime/timeline.test.ts +++ b/packages/core/src/runtime/timeline.test.ts @@ -139,6 +139,34 @@ describe("collectRuntimeTimelinePayload", () => { ]); }); + it("still lists every clip, with the labels it can read, when one timeline's labels throw", () => { + const root = document.createElement("div"); + root.setAttribute("data-composition-id", "main"); + root.setAttribute("data-duration", "10"); + root.innerHTML = ` +
+ `; + document.body.appendChild(root); + (window as TimelineTestWindow).__timelines = { + broken: { + duration: () => 10, + getLabels: () => { + throw new Error("a page's own timeline"); + }, + } as never, + main: { duration: () => 10, labels: { "hf:transition:a:b:fade": 2 } } as never, + }; + + const labels = collectRuntimeTimelinePayload(defaultParams).clips.map((clip) => [ + clip.id, + clip.transitionLabel, + ]); + expect(labels).toEqual([ + ["a", "hf:transition:a:b:fade"], + ["b", "hf:transition:a:b:fade"], + ]); + }); + it("collects clips from elements with data-start and data-duration", () => { const root = document.createElement("div"); root.setAttribute("data-composition-id", "main"); diff --git a/packages/core/src/runtime/transitionLabels.ts b/packages/core/src/runtime/transitionLabels.ts index 13c9e21bb0..3eccf0089e 100644 --- a/packages/core/src/runtime/transitionLabels.ts +++ b/packages/core/src/runtime/transitionLabels.ts @@ -26,6 +26,14 @@ function findTimedElement(doc: Document, markerId: string): Element | null { ); } +function labelsOf(timeline: TimelineWithLabels | undefined): Record