Skip to content

fix(studio): a clip's thumbnail strip stays put while you trim it - #6942

Merged
miguel-heygen merged 5 commits into
mainfrom
fix/timeline-edit-ffmpeg-lag
Nov 1, 2026
Merged

miguel-heygen merged 5 commits into
mainfrom
fix/timeline-edit-ffmpeg-lag

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Trimming a video clip on the timeline re-requested that clip's thumbnail strip on every pointer move, because the strip's request was keyed on the live trimmed range. A decode ran for frames thrown away a moment later.

Now the strip keeps the range it had while the trim is moving and decodes the new range once when the trim rests. Each trim move marks the timeline as moving, the same signal zoom already uses.

fails without the fix: packages/studio/src/player/components/VideoThumbnail.test.tsx › VideoThumbnail during a trim › keeps its strip through every move of a trim and decodes the new range once at rest

A second test, useTimelineClipDrag.resize.test.tsx › marks the timeline as moving on every trim move, so thumbnails hold their range, fails if the call that connects a trim to the hold is removed.

Measured on a Linux box with the real CLI preview server and a 25-file project (16 videos, 4 audio, 5 images, 9 tracks, 8 minutes). One video clip's end handle dragged 60 steps, fresh project each run, two runs per build:

before after
media requests during the drag 97, 156 12, 50
media requests, drag plus 4 s after 197, 270 52, 83
p95 frame time 17, 50 ms 17, 50 ms
long tasks 4, 24 3, 28

The request count drops two to three times. Frame time and long tasks did not change in these runs, and the strip stays visible during the drag in both builds (see the captures), so this does not claim a smoother drag, only less decode work per trim.

Before

Mid-trim before

After

Mid-trim after

Not claimed: the report also describes the preview taking close to a minute to show a timeline edit and all cores busy with ffmpeg. Neither was reproduced here (the proxy path ran at most one ffmpeg at a time), so this does not claim to fix them.

The Fallow audit red is the existing cognitive complexity of useTimelineClipDrag (61, over the threshold on main; this adds one call). VideoThumbnail stays at its main value of 25: the held request inputs live in one small hook, useRangeHeldDuringTrim, measured with fallow health on main and on this head.

Size

A lone fix: one hook value held at rest plus one call, and its tests.

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST CHANGES · 2 blocker · 1 important · 0 nits · head 196da9b2

  • blocker: the body has no fails without the fix: line naming the test. Add fails without the fix: packages/studio/src/player/components/VideoThumbnail.test.tsx › VideoThumbnail during a trim › keeps its strip through every move of a trim and decodes the new range once at rest. I checked it: with both source files reverted, it fails (decodeVideoThumbnail called 6 times).
  • blocker: two required checks fail on this head. PR captures fails because the body has no ## Before / ## After sections, each with an image or video. Comments fails because the comment share in VideoThumbnail.tsx rose from 0.5% to 0.9% (see inline).
Scope

I read the full diff, timelineMotion.ts (useValueAtRest, whenTimelineIdle) and every call to publishResizingClip. The held-range logic is correct: the strip holds during a trim and takes the committed range within TIMELINE_REST_MS of release. At head, VideoThumbnail.test.tsx passes 18/18. CodeQL and CI were still running at review time.

@github-actions

github-actions Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: accurate 271 (base branch 271), smooth 114 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE · 3 resolved, 0 open, 1 new · 196da9b2 → 6d08b15f

  • important: the PR body attributes the Fallow audit red entirely to existing complexity, and that is only partly true. useTimelineClipDrag is 61 cognitive at both the base and this head. VideoThumbnail rose from 25 to 27 (threshold 15). This PR adds the second useValueAtRest(useMemo(...)). Moving that into a small hook (useRangeHeldDuringTrim) would bring it back to 25. Recently merged PRs all had Fallow green or skipped. If the job is a required check, the merge will stay blocked until it passes.

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: REQUEST CHANGES · 1 resolved, 0 open, 1 new · 6d08b15f → e214e8c6

The Fallow finding is fixed: VideoThumbnail is back to 25 and fallow audit --base origin/main is clean. The new docstring fails the Comments ratchet again (↓ inline). Tests pass 1841/1841 and tsc is clean.

@heygengenesis heygengenesis Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verdict: APPROVE · 1 resolved, 0 open, 0 new · e214e8c6 → b0cf4549

The delta is the removed docstring line only, and Comments passes on this head. CI and CodeQL were still running at review time.

@miguel-heygen
miguel-heygen added this pull request to the merge queue Nov 1, 2026
Merged via the queue into main with commit 0ab4931 Nov 1, 2026
78 checks passed
@miguel-heygen
miguel-heygen deleted the fix/timeline-edit-ffmpeg-lag branch November 1, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant