Skip to content

@remotion/studio: Avoid re-registering timeline keybindings on selection change - #7843

Merged
JonnyBurger merged 1 commit into
mainfrom
jonnyburger/studio-handler-perf
May 30, 2026
Merged

@remotion/studio: Avoid re-registering timeline keybindings on selection change#7843
JonnyBurger merged 1 commit into
mainfrom
jonnyburger/studio-handler-perf

Conversation

@JonnyBurger

Copy link
Copy Markdown
Member

Summary

Avoids re-registering the timeline Backspace (delete) and Cmd/Ctrl+A (select-all) keybinding handlers every time the timeline selection changes.

Previously, TimelineDeleteKeybindings and TimelineSelectAllKeybindings depended on selectedItems / selectableSequenceSelections / selectItems / clearSelection in their useEffects, which caused the keybindings to be unregistered and re-registered on every selection mutation.

The latest selection state is now read through a new useCurrentTimelineSelectionStateAsRef hook, which exposes the up-to-date context value via a ref. The effects no longer depend on the changing selection, so the keybindings are registered once and stay registered while the provider is mounted.

Test plan

  • Select timeline items and press Backspace — items still get deleted
  • Press Cmd/Ctrl+A in the timeline — all selectable items get selected
  • Verify keybindings still work after repeatedly changing the selection

@vercel

vercel Bot commented May 30, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
bugs Ready Ready Preview, Comment May 30, 2026 10:04am
remotion Ready Ready Preview, Comment May 30, 2026 10:04am

Request Review

@pullfrog pullfrog 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.

✅ No new issues found.

Reviewed changes — avoids re-registering timeline Backspace and Cmd/Ctrl+A keybindings on every selection change by reading mutable selection state through a ref instead of depending on it in useEffect.

  • TimelineDeleteKeybindings — removes selectedItems / clearSelection from useEffect deps; reads latest selection via currentSelection.current inside the keybinding callback.
  • TimelineSelectAllKeybindings — removes selectableSequenceSelections / selectItems from useEffect deps; reads latest selections via ref.
  • TimelineSelectionProvider — wraps children in a new CurrentTimelineSelectionContext that exposes the full context value as a ref, paired with a new useCurrentTimelineSelectionStateAsRef consumer hook.

Clean, focused perf improvement with no behavioral change.

Pullfrog  | View workflow run | Using Kimi K2𝕏

@JonnyBurger
JonnyBurger merged commit 38ceacb into main May 30, 2026
18 of 19 checks passed
@JonnyBurger
JonnyBurger deleted the jonnyburger/studio-handler-perf branch May 30, 2026 11:41
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