Repository navigation
fix(studio): a sealed undo or redo of a keyframe edit re-runs in place instead of reloading - #8272
Merged
Merged
Conversation
…e instead of reloading
Contributor
Edit accuracy: accurate 271 (base branch 271), smooth 50 of thoseThe gate passes. Quarantined, measured but not gated (0) |
eddy-heygen
approved these changes
Nov 20, 2026
eddy-heygen
left a comment
There was a problem hiding this comment.
(Eddy's agent) Reviewed by Eddy's Claude agent at commit 8b5096c (non-test diff read by me).
Verdict: approve.
Summary
In a sealed preview, undoing or redoing an edit that also changed the animation script reloaded the whole preview. The soft-reload request now carries the restored attributes, and the frame applies them and re-runs its script in place.
What I checked
- The new
restorefield is parsed by the same scope parser the existing restore request uses, with the same limits on the number of scopes and elements; a request without the exact field set is refused. - The frame plans the restore first and answers "cannot soft reload" if any element is missing, not the file's own, or unsafe to change, before anything is modified; the caller then falls back to a full reload.
- The attribute writes go through one shared function used by both paths, so the restore applies the same drop-and-set rules as before.
- On the Studio side a failed or refused soft reload still ends in a full reload.
CI: 88 pass, 11 skipped, none failing or pending.
This was referenced Nov 20, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
In a sealed preview (Studio cannot script the frame), an undo or redo of an edit saved into the GSAP script now re-runs the restored script in place. Before, it reloaded the whole preview. That covers every move, resize or rotate of an animated layer saved as a keyframe. The preview no longer blanks and rebuilds on each such undo or redo, and it shows the restored state as soon as the frame answers.
Why
gsapUndoRestore.tsturned any undo whose script text changed into a full reload. Its comment said a sealed preview could not yet be asked to re-run a script. Since #8158 it can: an edit already re-runs its script in a sealed frame through thesoft-reloadrequest. Undo and redo were never routed to it. A same-origin preview already re-runs the restored script in place for the same undo.How
Core:
softReload.ts: asoft-reloadrequest also carriesrestore, the restored attributes of the elements the undo changed, in the same shaperestore-attributestakes (empty for an edit).restore-attributes' own planner before touching anything. That keeps one set of rules for which attributes may be set or dropped, all or nothing.cannot-soft-reloadand nothing changes.restoreAttributes.ts: the scope parser, the planner and the apply step are exported for that.restore-attributesitself behaves as before.Studio:
gsapUndoRestore.ts: when the active file's script changed, a sealed undo or redo sends onesoft-reloadwith the restored script, the restored file's authored styles, what the outgoing script set, and the restored attributes. Any refusal reloads the preview as before. It still reloads when a file other than the active one changed its script, when several scripts changed, or when restoring the attributes is refused. The stale comment is gone.gsapSoftReload.ts: the sealed re-run passesrestorethrough (empty for an edit).Related work
Builds on #8158. #8264 (open) adds a rule to
restore-attributesfor marks the page's reapply script keeps; whichever lands second moves that rule into the shared planner, so this request follows it too.Test plan
softReload.test.ts:onclick) refuses the whole request: the style, the script and the timelines stay as they were;restorefield or a restore element keyed by neither id.gsapUndoRestore.sealed.test.ts: a sealed undo whose script changed sends onesoft-reloadwith the restored script and the changed attributes (or none when only the script changed), and does not reload; acannot-soft-reloadanswer reloads.gsapSoftReload.sealed.test.ts: an edit's request carries an emptyrestore.fails without the fix: with the frame never setting the restored attributes, the first
softReloadtest fails; with an unsafe restore not refusing the request, the second fails; with the old script-changed reload insealedFile, both re-run cases of the sealed undo test fail.Run on Linux at this head: core
softReload,restoreAttributes,editingAgent,editingPortand Studio's five touched test files pass three runs in a row; core and Studiotscno errors; format clean; the code audit passes.Bench
Edit-accuracy bench, sealed preview on (the sealed-by-default change, #8263 and #8271 merged with this branch), the redo cases the reload made miss, run one at a time with a trace, twice before and twice after:
The resize goes in place only with #8264. On main it still reloads, because its restore sets Studio's own
data-hf-studio-*marks, whichrestore-attributesdoes not set until #8264. With #8264 merged in (traced), it restores in place and its redo is 0 px off.The nested cases still reload, because their script lives in a sub-composition file. Their drop is also off, before and after; that is a known separate miss.
Before
Sealed preview, a layer its tween moves, moved and undone, then redone. Counted from the redo key: the preview loads two new documents (the full reload), and the box reaches the saved place after 385 ms.
After
The same redo: no new preview document, and the box is at the saved place after 56 ms.