Skip to content

fix(studio): a reload requested while a canvas save is in flight loads again once it lands - #4874

Merged
miguel-heygen merged 2 commits into
mainfrom
fix/studio-reload-counts-settled-saves
Oct 1, 2026
Merged

miguel-heygen merged 2 commits into
mainfrom
fix/studio-reload-counts-settled-saves

Conversation

@miguel-heygen

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

Copy link
Copy Markdown
Collaborator

What

Follow-up to #4856. A reload requested while a canvas save is still in flight no longer goes on screen with the file from before the save.

#4856 counts each canvas save when it starts, and a shadow reload requested before a later count loads again instead of being promoted. A reload requested after the count but before the save landed recorded the new count, so it was promoted with the old file.

How

  • countStudioManualEditSave(element, save) runs the save and counts it twice: as it starts and as it settles. It replaces the start-only count.
  • The overlay's commit refs (move, group move, resize, rotate, crop and other canvas style commits) and the inline text commit go through it.
  • The cost: a reload a save triggers itself, on the full-reload path, is counted as stale once and loads one more time. It never shows the old file.

Tests

gestureHoldsPreviewReload.test.tsx:

  • A reload requested during a move, a resize, a rotate and a crop, painting after the release, is not promoted; a fresh load shows the edit (one case each, so dropping any one path's count fails).
  • A reload requested while the drop is still saving, painting after the save lands, is not promoted; a fresh load shows the drop.
  • A press that throws before the drag is armed leaves no mark, for one layer and for a group.

The race has no path through Studio's own UI. An edit to the file from outside waits for pending saves before it reloads, and Studio's own saves queue behind each other. Only a reload a host triggers inside the save window reaches it, and that is what the new tests drive.

Before

Main (78e8492), from the CLI's blank template in a real browser: select the title, drag it, hold its save request, edit index.html from outside during the hold, then let the save land. The outside edit waits for the save, so the drop shows:

before walk

The late-reload test, run on main with this PR's tests: the save-in-flight case fails.

before tests

After

This branch, the same walk: the drop shows, the same as main, so the outside-edit path is unchanged.

after walk

The same tests on this branch all pass.

after tests

@miguel-heygen
miguel-heygen force-pushed the fix/studio-reload-counts-settled-saves branch from 156fe97 to 94bf2e9 Compare October 1, 2026 19:17
@github-actions

github-actions Bot commented Oct 1, 2026 •

Copy link
Copy Markdown
Contributor

Edit accuracy: 841 passing here, 841 on the base branch

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 (7)

Unstable (1)

  • seqab-none-center-r0-nested-z100: tracking 0.04, pressJump 0, drop 0, reload 0, render 0.02, undo false, teleport true / tracking 0.04, pressJump 0, drop 0, reload 0, render 0.02, undo true, teleport true / tracking 0.04, pressJump 0, drop 0, reload 0, render 0.02, undo true, teleport true

@miguel-heygen
miguel-heygen marked this pull request as ready for review October 1, 2026 20:52
@miguel-heygen
miguel-heygen merged commit d05344b into main Oct 1, 2026
120 of 121 checks passed
@miguel-heygen
miguel-heygen deleted the fix/studio-reload-counts-settled-saves branch October 1, 2026 20:56
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