Repository navigation
fix(studio): a drag pressed right after a reload moves the element on screen - #8836
miguel-heygen wants to merge 3 commits into
Conversation
… screen A press on a settled, scriptable preview started straight from Studio's held selection. Just after a reload swapped the page, that selection could still name the replaced page's element: the drag moved an element nobody sees and the release saved nothing. Such a press now finds its targets again on the shown page, as a press that waited for the reload already does.
|
The step-5 drag of BeforeOn main AfterOn Runs on
|
| Preview | Runs | Gated checks |
|---|---|---|
sealed (origin null) |
3 | 3 pass |
| unsealed | 5 | 5 pass |
Smoothness, not gated, is below its mark in all eight, as on main.
The names namesReplacedPage and findAgain carry what the two added comments said.
Edit accuracy: accurate 273 (base branch 271), smooth 50 of thoseThe gate passes. Newly passing (2)
Not banked yet, reported and not gated (bank a full-grid run's baseline.json) (2)
Quarantined, measured but not gated (0) |
jrusso1020
left a comment
There was a problem hiding this comment.
Review at 4231a4df: request changes. The fix is still right, but this merge head fails a test that main just brought in. The two changes collide.
Test (studio 2/3):domEditOverlayStartGesture.test.ts› "a corner resize on a frame Studio scripts" › "pins its centre by the grow the sealed frame would report, so both modes save the same offset" fails withTypeError: Cannot read properties of undefined (reading 'current')atpreviewGestureStarts.ts:296(shownSelection). The stack runsstartGesture(373) →startOnShownPreview(175) → the start callback (381) →shownOnPage(305) →shownSelection(296).- Why: that test arrived with #8824 on main. Its selection's element is not in the iframe's
contentDocument, so this PR'snamesReplacedPagereturns true and the start takes thefindAgainpath. That path reads anoptsref that the test's options object does not provide. Main alone passes it (main CI at22f268e2is green), and so does4267801falone. Only the combination fails. - Fix, either way: give that test's
optsthe refshownSelectionreads, with its element in the frame's document if it means "a selection on the shown page". Or, if that test's selection really can live in another document, decide whethernamesReplacedPageshould apply there.
I'll approve the next head once required CI is green.
Need · Size · Reuse · Simpler · Structure: unchanged.
Risk: low. The only blocker is the collision with #8824's test.
— Rames


What
A drag pressed on the canvas right after a reload swapped the preview page now moves the element on screen and saves the move. Before, the press could start on the element of the page the reload had replaced: nothing on screen moved, and the release saved nothing.
Why
The edit accuracy case
seqfastkeys-none-px-r0-root-z100failedtracking(194 px) on unsealed previews now and then, and bounced PRs from the merge queue. Its step 5 drags right after Add keyframe, whose save reloads the preview. When the press landed just after that reload finished, nothing in the step-5 drag moved:isPreviewChanging()was already false, so the press took the start-at-once path.startGestureStudio's held selection (selectionRef), which still named the replaced page's element. The drag measured that element as "Element has no measurable box", every move drew onto it, and the release committed nothing (no write atpointerup; every passing run writes there).shownOnPage), so it never had this problem.Related work
Refs #7846 (its edit accuracy gate reported the same case).
How
previewGestureStarts.ts: the start-at-once path now passesfindAgain(renamed fromwaited) when any pressed target's element is not in the shown document (namesReplacedPage). The start then finds the targets on the shown page, the same way a waited press does. A selection already on the shown page starts as before.startGestureandstartGroupDragindomEditOverlayStartGesture.tsare imported only bypreviewGestureStarts.ts, and the canvas calls them only through it (DomEditSelectionChrome.tsx: the group drag at :120, rotate :198, drag :232, resize :276).Test plan
fails without the fix:
packages/studio/src/components/editor/previewOverlayRects.test.ts"on a scriptable frame starts on the shown page's element when the selection still names the replaced page's" fails on main (expected undefined to be <div id="turned">), and again withnamesReplacedPageforced to false.previewOverlayRects.test.tsandgestureHoldsPreviewReload.test.tsx: 68 of 68, three runs in a row.src/components/editor/: 2207 passed, 1 failed, "words selected in a unsealed text edit show the toolbar, and Bold saves one span" (5.3 s), which fails the same way on main.tsc --noEmitinpackages/studioclean.The bench on the devbox (built CLI,
--filter '^seqfastkeys-none-px-r0-root-z100$',--jobs 1), each run's preview frameself.originlogged (nullsealed):"pass" means every gated check passed. Smoothness, which the gate reports but does not gate, is below its mark in every run of every row.
Not run: the full grid.
Before and After captures follow in a comment.