Repository navigation
fix(studio): a waiting press says whether it waits on the frame or a save - #8596
Conversation
…nless Studio is saving
…, and score it so
…ss-rest-2 # Conflicts: # packages/studio/tests/e2e/edit-accuracy/case.mjs # packages/studio/tests/e2e/edit-accuracy/settle.test.mjs # packages/studio/tests/e2e/edit-accuracy/teleport.mjs # packages/studio/tests/e2e/edit-accuracy/teleport.test.mjs
Edit accuracy: accurate 271 (base branch 271), smooth 65 of thoseThe gate passes. Quarantined, measured but not gated (0) |
vanceingalls
left a comment
There was a problem hiding this comment.
#8582 was reverted because it read the element for every waiting press, and a press made while a save was in flight sat 312 px off. This version has Studio say why it waits: "save" when the press queues behind another press, the preview is changing, or an edit is saving, and "frame" otherwise; the bench reads the element before the pointer moves only for a frame wait, so the seqheldtwice case is scored as before. Other readers of data-dom-edit-press-waiting only check presence. Fix-line tests reproduce #8582's failure and edit-accuracy is green. Approving.
Note: this conflicts textually with #8578 in previewOverlayRects.test.ts (the opts object moved into pressOn()); whichever merges second needs a rebase and pressOn must carry onBlockedMoveRef.
What
Studio's waiting selection box now says why a press waits:
data-dom-edit-press-waiting="frame"when a sealed press only waits for the frame's answer,"save"when it waits on a save, a reload, or an earlier press. The edit-accuracy bench uses it to measure a sealed press the way it measures an open one: by the element until the pointer moves, unless the press waits on a save, where the element is stale and the box is what's shown.This re-lands #8582, which was reverted because it read the element for every waiting press. In
seqheldtwice-tlhold-px-r0-root-z100the second resize is pressed while the first save is still in flight, so the element sat 312 px from the box Studio showed, and the case failed.Why
Every sealed press waits about 24-38 ms for the frame's answer, with nothing reloading, and Studio marks its box as waiting meanwhile. An open press waits only when a save or reload is in flight. Until the pointer moves, a box waiting on the frame is Studio's outline at rest, up to 0.2 px off the element's own box in both modes, so scoring it made sealed tracking and teleport read 0.06-0.15 px worse than open on drags that draw the same thing. A box waiting on a save is different: it is drawn where the press will land while the element still sits where the last save left it. The attribute alone could not tell the two apart. Studio knows which it is when it starts the wait, so it says so.
How
packages/studio/src/components/editor/previewGestureStarts.ts: a waiting press is"save"when it queues behind another press, the preview is changing, or an edit is saving; otherwise"frame".packages/studio/src/components/editor/pressOutline.ts:waitOnSave(reason)writes it. It stays the attribute's one setter; every reader tested only its presence.packages/studio/tests/e2e/edit-accuracy/case.mjsandteleport.mjs: at the press, and in the tracker until the pointer first moves, a box waiting on"frame"gives way to the element; any other waiting box still stands in for it.Test plan
fails without the fix:
packages/studio/src/components/editor/previewOverlayRects.test.ts, "says why a press on an opaque frame waits, the preview changing: %s" (on main the box reads"true"in both);packages/studio/tests/e2e/edit-accuracy/settle.test.mjs, "reads the waiting box at the press while it waits on a save" (with #8582's rule it read the element, 0 against 260) and "reads the element at the press, before the pointer moves";packages/studio/tests/e2e/edit-accuracy/teleport.test.mjs, "scores a press that waits on Studio from the box Studio shows" (with #8582's rule 312 against 0) and "scores a press that waits with the pointer still like one that never waited".Existing tests that changed: "drags its element on the reloaded preview, at the time it was pressed" (
gestureHoldsPreviewReload.test.tsx) now checks the box says"save", not only that it waits; a stand-in outline inteleport.test.mjsgets thegetAttributethe sampler now reads.With the fix, on a Linux machine: the touched files and the bench's own tests pass three runs in a row (192 tests), the push gate's 16 covering files pass, and
tsc, Fallow and pre-push are clean.Bench, every
seqheldtwicecase (nested and root) built from main, four runs per mode, worst per run in px:All 16 case runs pass every check. #8582 failed the root case in every run with a 312 px press jump. The 13 scale-resize cases were measured for #8582, whose rule for a press waiting on the frame this keeps; they were not rerun on this head.
No visible change
The box looks the same: the attribute's value changes and no style reads it.