Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
perf(core): a paused Studio drag lets the preview loop sleep until the drag ends (#4938)
Miguel Ángel96bc879b5bba
diff --git a/packages/core/src/runtime/init.ts b/packages/core/src/runtime/init.tsindex 8ce7f5d777..8e0dcb37f9 100644--- a/packages/core/src/runtime/init.ts+++ b/packages/core/src/runtime/init.ts@@ -3005,6 +3005,7 @@ export function initSandboxRuntimeModular(): void {};const releasePausedMedia = (el: HTMLMediaElement): void => {pausedMediaLeases.delete(el);+ wakeTransport();};window.__hf.leasePausedMedia = leasePausedMedia;window.__hf.releasePausedMedia = releasePausedMedia;@@ -4425,8 +4426,8 @@ export function initSandboxRuntimeModular(): void {// running transport. This stays as the explicit statement of the// invariant, one boolean, for the day that guard is added there.manualEditGestureWatch.observing &&- // A drop/cancel owes one reconciling seek that has not happened yet.- !pausedSeekDeferredByManualGesture &&+ // A drop/cancel owes one reconciling seek; the gesture watch wakes the loop when it clears.+ (!pausedSeekDeferredByManualGesture || hasActiveStudioManualEditGesture()) &&// A composition change is owed a manifest post that the rate limit has// deferred. Parking here would strand it until the next unrelated change,// so the loop stays awake — for at most one cadence interval — until thediff --git a/packages/core/src/runtime/transportPark.test.ts b/packages/core/src/runtime/transportPark.test.tsindex 2a030639d5..e3d3e3c16e 100644--- a/packages/core/src/runtime/transportPark.test.ts+++ b/packages/core/src/runtime/transportPark.test.ts@@ -480,8 +480,8 @@ describe("parked transport loop", () => {target.setAttribute(STUDIO_MANUAL_EDIT_GESTURE_ATTR, "token-1");await flushObservers();raf.step();- // A gesture owns the paused frame: the loop stays awake and defers the seek.- expect(raf.pending()).toBe(1);+ // A gesture owns the paused frame: the loop defers the seek and parks until the marker clears.+ expect(raf.pending()).toBe(0);const timeline = window.__timelines!["main"] as RuntimeTimelineLike;const seeks: number[] = [];@@ -781,7 +781,6 @@ describe("parked transport loop", () => {expect(media.isPaused()).toBe(false);window.__hf!.releasePausedMedia!(video);- media.start();settle();expect(media.isPaused()).toBe(true);});