fix(studio): keep layer selection seek within clip range#793
Conversation
Only seek when the current playback time is outside the selected clip's range. When the user clicks a layer whose clip already contains the current time, the seek is skipped — avoiding unwanted preview jumps during playback. Fixes heygen-com#792
vanceingalls
left a comment
There was a problem hiding this comment.
First review at efea6497.
Blocker — LayersPanel.tsx is added as a NEW FILE but the file already exists
gh pr files 793 --repo heygen-com/hyperframes shows:
{"file":"packages/studio/src/components/editor/LayersPanel.tsx","status":"added","additions":295}
status: "added" against an existing file means the PR was authored against a base where the file didn't exist — likely a branch from before the LayersPanel landed on main. As soon as this rebases against current main, you'll either:
- get a merge conflict (the file already has 295 different lines), or
- silently overwrite the existing component, losing every change committed to LayersPanel since the branch point.
The CI shape ("no checks reported on the 'fix/layer-selection-seek' branch") suggests the branch hasn't been refreshed in a while and the merge state is stale.
Blocker — superseded by #792
#792 (func25) addresses the same bug — "Keep Layers panel selection seek within clip range" — but does it correctly:
- Modifies the existing
LayersPanel.tsx(status: modified, +15/-5) instead of recreating it - Extracts the clamp logic into a pure helper
resolveTimelineSelectionSeekTimeinpackages/studio/src/utils/studioHelpers.ts - Adds unit tests for the helper covering all four branches (inside-range / before / after / NaN-input)
- CI fully green
#792 is also the PR your branch description says you closed (Closes #792). That's reversed — your PR is the duplicate, not #792's.
Recommendation
Close this PR; #792 ships the same fix safely. Worth noting that #794 (caption JSON.stringify, same author) and #795 (ObjectURL revoke + tsconfig, same author) ALSO add LayersPanel.tsx as a new file — same issue. They should each drop the LayersPanel addition and keep only the file each PR's title describes.
Verdict
Verdict: REQUEST CHANGES
Reasoning: The PR would clobber the existing LayersPanel.tsx on merge (re-adds an already-existing file as new). #792 ships the same fix correctly with extracted helper + tests. Recommend closing this PR.
— Vai
Summary
Clicking a layer in the Layers panel was always seeking to the clip midpoint, even when the playback head was already inside that clip. This caused unwanted preview jumps during playback.
What changed
packages/studio/src/components/editor/LayersPanel.tsx—seekToLayernow readscurrentTimefrom the player store and only callsrequestSeekwhen the current time falls outside the selected clip's[start, start+duration]range.Closes #792