@remotion/studio: Refactor timeline selection state for multiple items - #7808
Conversation
…le items
Internally switches the timeline selection state from a single selectedItem
to a selectedItems array, allowing zero, one or many items to be selected
at once. Selected items must all share the same type (rows or keyframes);
attempting to mix types replaces the existing selection, and a runtime
assertion enforces the invariant.
- selectItem now accepts an optional {additive} flag; click handlers pass
it when shift/meta/ctrl is held so users can toggle items in and out of
the selection.
- containsSelection and isSelected now consider every selected item.
- Backspace deletes every selected item in parallel via Promise.all and
clears the selection once the requests are dispatched.
Split out from #7782. Closes #7799.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…efactor only) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
There was a problem hiding this comment.
Reviewed changes — Refactored timeline selection state from a single selectedItem to a selectedItems array with additive selection support (shift/cmd/ctrl + click), parallel batch deletion, and cleanup of the now-unused keyframed-value interpolation path.
- Multi-select state management in
TimelineSelection.tsx— ReplacedselectedItemwithselectedItems, addedSelectItemOptionsfor additive toggling, and optimizedisSelectedwith aSetof selection keys. - Batch deletion in
TimelineDeleteKeybindings.tsx— Backspace now firesdeleteSelectedTimelineItemin parallel viaPromise.alland clears the selection afterward. - Additive click handlers —
TimelineRowChrome,TimelineSequence, andTimelineKeyframeDiamondall pass{additive: e.shiftKey || e.metaKey || e.ctrlKey}toonSelect. - Removed dead keyframed-value code — Deleted
interpolate-keyframed-status.ts, its test file, andTimelineKeyframedValue.tsx; removedframeparameter fromcomputeEffectiveSchemaValuesDotNotationandwrapInSchema. - Cleaned up
keyframeDisplayOffsetplumbing — Removed the prop from all expanded row/field components since keyframed values are no longer rendered inline.
ℹ️ Nitpicks
CanUpdateSequencePropStatusKeyframedis still exported frompackages/core/src/use-schema.tsand re-exported viaInternals, but nothing in the codebase references it anymore after this PR. Consider removing the type and its export to keep the surface clean.assertSameTypeinTimelineSelection.tsx(line 105) is defensive but effectively unreachable through normal UI interaction becauseselectItemalready replaces the selection when a differently-typed item is added. It doesn't hurt, but it's redundant.
Kimi K2 | 𝕏
There was a problem hiding this comment.
Reviewed changes (incremental) — The follow-up commit 2de6be2 reverts the user-facing additive-selection UI (shift/cmd/ctrl + click) from TimelineRowChrome, TimelineSequence, and TimelineKeyframeDiamond while keeping the internal refactor intact. This is a clean, conservative approach: the state layer now supports multiple selections and batch deletion, but the UI continues to behave as single-select until a future PR enables multi-select interactions.
- Revert is complete — No dangling
SelectItemOptionsimports or additive handler logic remains in the three UI components. - Types remain consistent —
useTimelineRowSelectionanduseTimelineKeyframeSelectionstill exposeonSelect(options?), but the consumers'() => voidprop types are assignable in TypeScript (optional parameters are compatible). - No regressions introduced — The revert only removes the modifier-key click handling; all internal state,
selectedItemsarray logic, andPromise.allbatch deletion remain unchanged.
Kimi K2 | 𝕏
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Reverts the removal of CanUpdateSequencePropStatusKeyframed: the type is now consumed by interpolate-keyframed-status.ts and re-exported from internals.ts on main, so it is no longer unused. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Summary
Refactors the timeline selection state from a single
selectedItemto aselectedItemsarray so 0..n items can be selected at once. Existing single-click behaviour is preserved; shift / cmd / ctrl + click now toggles items into or out of the selection.Details
type(rows or keyframes). Adding a differently-typed item replaces the selection, and a runtime assertion enforces the invariant.selectItemnow accepts an optional{additive}flag wired into the click handlers inTimelineRowChrome,TimelineSequence, andTimelineKeyframeDiamond.isSelectedandcontainsSelectionconsider every selected item.Promise.all) and clears the selection.Split out from #7782. Closes #7799.