Skip to content

fix: return defensive copies from public clip getters#137

Merged
dazzatronus merged 1 commit into
mainfrom
derk/fix-live-refs-public-getters
Jul 13, 2026
Merged

fix: return defensive copies from public clip getters#137
dazzatronus merged 1 commit into
mainfrom
derk/fix-live-refs-public-getters

Conversation

@dazzatronus

Copy link
Copy Markdown
Contributor

What changed

getClipById, getClip, and getTrack returned references to live internal state (the document clip and player clip configurations). A caller that mutated the returned object silently changed the running edit, and a caller that froze it — common with state libraries that auto-freeze, such as immer or Redux Toolkit — locked the edit's internal state in place, so the next resize or drag threw TypeError: Cannot add property width, object is not extensible.

These getters now return copies, matching the library's existing convention of copying inputs at the document boundary. Mutating a returned clip no longer affects the edit — use updateClip/updateClipById to make changes.

How to verify

Regression tests in tests/edit-clip-operations.test.ts ("defensive copies from public getters"): freezing a clip returned by getClipById must not break in-place document updates, and objects returned by getClip/getTrack are detached from player state. Full suite passes (1844 tests).

@dazzatronus
dazzatronus merged commit 1935821 into main Jul 13, 2026
1 check passed
@dazzatronus
dazzatronus deleted the derk/fix-live-refs-public-getters branch July 13, 2026 00:47
@github-actions

Copy link
Copy Markdown

🎉 This PR is included in version 2.13.2 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant