Skip to content

fix(studio): undo keeps a reloaded GSAP edit undone and a newer gesture's look intact - #5035

Closed
miguel-heygen wants to merge 2 commits into
mainfrom
fix/studio-undo-paintback-overlaps
Closed

miguel-heygen wants to merge 2 commits into
mainfrom
fix/studio-undo-paintback-overlaps

Conversation

@miguel-heygen

@miguel-heygen miguel-heygen commented Oct 4, 2026 •

Copy link
Copy Markdown
Collaborator

What

This closes three gaps in how undo shows an edit that is still saving:

  1. An undone GSAP edit came back. If you pressed undo after a GSAP edit's preview had already reloaded with the change, the next seek or play redrew the edit, even though undo had already shown it as undone.
  2. A new gesture got reset. If you undid an edit and straight away dragged, resized or rotated the same element, the old edit's late writes (its save drawing the final position or size) could reset the element under your pointer, plain or GSAP.
  3. A failed undo left stale state. When the server refused an undo and the edit was shown again, the edit still reported itself as undone. A later draw for it would then have been held back.

Why

The paint-back from the earlier change only undid what was on the element. A soft reload that had already run left the edited timeline in the preview. A late write of a painted-back edit ended by re-applying the look from press time, wiping anything drawn since.

How

  • Undoing a reload. A GSAP commit's redraw now registers how to undo itself: a soft reload of the file as it was before the commit. Painting the edit back runs that, and "show again" redraws the edit. The undo reload never escalates to a full reload, because a full reload would load the edited file back from disk.
  • Leaving a new gesture alone. A late write of a painted-back edit runs on the edit's own look, as before, but now ends on whatever the element showed just before the write, rather than on the look from press time. All of it runs in one task, so nothing flickers. A newer gesture's look survives, and with no newer gesture this is the undone look, as before. A refused undo still shows the edit again, because the file has it.
  • Clearing the undone state. "Show again" clears the undone state, so reverted() is false again and later draws show at once.

The confirm decision in useEditHistoryActions (whether the server's undo stepped this edit) is not touched. That stays with #4937.

Before / After

(captures attached before ready)

Test plan

  • Red first. These tests failed on main and pass with the fix:
    • a resize's late write keeps a newer gesture's style;
    • a GSAP drag's late write keeps a newer drag's position;
    • the undo reload of a GSAP edit;
    • a redraw that already ran is undone and redone;
    • "show again" clears the undone state.
  • Guards. A newest-first undo-order test, and a test that a tap on the box does not stop a refused undo from showing the drag again.
  • Each part breaks a test. Removing any one part of the fix turns at least one of them red:
    • ending on the pre-write look;
    • the undo reload;
    • its newest-first order;
    • the reset of the undone state.
  • Three runs. The changed test files pass 3 runs in a row (73/73).
  • Related suites. The 25 related test files pass (419 tests).

@github-actions

github-actions Bot commented Oct 4, 2026 •

Copy link
Copy Markdown

Edit accuracy: accurate 1562 (base branch 1562), smooth 1139 of those

The gate passes.
Smoothness is reported in the artifact, not gated. A case fails only if it fails 2 of 3 runs.

Quarantined, measured but not gated (0)

@miguel-heygen miguel-heygen changed the title fix(studio): undo keeps a reloaded GSAP edit undone and spares an element a newer gesture took fix(studio): undo keeps a reloaded GSAP edit undone and a newer gesture's look intact Oct 4, 2026
@miguel-heygen

Copy link
Copy Markdown
Collaborator Author

Closing: browser runs on main and this branch showed no user-visible difference for any gesture that reaches these paths today. The branch stays for reference.

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