Mockup: folder-card drop (quiet.md) #1030

Open
opened 2026-11-09 11:39:37 +00:00 by kayg · 8 comments
Owner

kayg 11-09: "WOW we need this interaction". Folder cards that take dragged notes and files. Branch feat/folder-drop, preview slot folder-drop. Evidence in the comment below.

kayg 11-09: "WOW we need this interaction". Folder cards that take dragged notes and files. Branch `feat/folder-drop`, preview slot `folder-drop`. Evidence in the comment below.
Author
Owner

Folder-card drop: evidence

Branch feat/folder-drop (head 7b8321cb8), preview slot https://preview.calternal.cloud/folder-drop/

Side-by-side with the reference: the reference clip is a third-party app and stays LOCAL (privacy rule), so it is not attached. The local side-by-side is /tmp/fd-bench/media/LOCAL-side-by-side-notes-vs-reference.mp4 (its crop starts early and is not aligned to the drag, so it is rough). Ours only, Chromium recording at 1440x900: Notes, 2x, Files, 3x.

Stills: open files open slide

Frame times, REAL Safari on the Mac VM (macos-01), 1440x900 and 800x900, 7 drags each

Method: safaridriver, real mouse actions; rAF deltas cut by phase (drag = pull to the card, hover = 760 ms rest incl. the 600 ms spring-open, drop = release + 480 ms, toast = the move toast). The idle baseline is the same length with no input. The VM runs at 60 Hz (17 ms frames), so the 8.3 ms gate cannot be read here: the column that matters is "max / frames over 25 ms" and the main-thread work per frame.

area @1440 phase n p50 p95 max >25 ms
Files idle 114 17 20 21 0
Files drag 244 17 18 33 1
Files hover/open 316 17 19 23 0
Files drop 194 17 18 23 0
Files toast 119 17 18 20 0
Notes idle 114 17 20 36 1
Notes drag 245 17 18 21 0
Notes hover/open 316 17 19 23 0
Notes drop 189 17 27 56 10
Notes toast 104 17 33 46 9

800 px: Files all clean (max 40 in drag, 1 frame); Notes drop p95 29 / max 54, toast p95 29 / max 43.
Main-thread work per frame (p95): drag 4 ms, hover 3 ms, drop 4 ms (max 6), Files 2-3 ms.
Latency: pointer past threshold to the lifted page, p50 ~27 ms; release to first slide frame ~10 ms (Files ~6 ms). Spring-open fired at 600 ms in 14/14 runs.

Honest result: NOT fully within the gate. Files, drag, hover and open are clean. The Notes DROP still has ~10 frames over 25 ms per 7 drops, and the move toast opening costs more (45 ms). Main-thread work in those frames is only 4-6 ms, so the long frames are paint/composite (the list closing a gap and the toast glass), not script. Fixed along the way: a page-wide cursor rule (60 ms first frame), container-unit transforms, gliding every row (dozens of layers), toast in the release frame. Open: the Notes list gap closing and the toast's glass layer; next try would be moving the toast later/out of the Notes drop or content-visibility on rows. 120 Hz was not measurable on this VM.

Specs (Playwright, tests/folder-drop.spec.ts, 390/800/1440)

  • Chromium: 21 passed, 6 skipped (desktop-only gestures at 390), all green.
  • WebKit (Linux): last full run 17 passed, 2 failed on an upper time bound for the 600 ms dwell that I then removed (no wall-clock asserts in functional specs); the re-run after that is not yet confirmed.
  • Covered: drop moves the item, multi-select drop moves all, Esc cancels, 600 ms hover springs open, drop on nothing returns home, touch drop at 390 (Chromium, real touches).
## Folder-card drop: evidence Branch `feat/folder-drop` (head 7b8321cb8), preview slot https://preview.calternal.cloud/folder-drop/ - Notes folders: https://preview.calternal.cloud/folder-drop/#/note/spiti?list=folders&view=list - Files grid: https://preview.calternal.cloud/folder-drop/#/files/documents/taxes/2026?view=grid **Side-by-side with the reference:** the reference clip is a third-party app and stays LOCAL (privacy rule), so it is not attached. The local side-by-side is `/tmp/fd-bench/media/LOCAL-side-by-side-notes-vs-reference.mp4` (its crop starts early and is not aligned to the drag, so it is rough). Ours only, Chromium recording at 1440x900: [Notes, 2x](https://git.kayg.org/attachments/19c9a07f-2490-4120-9348-f5d508b9856f), [Files, 3x](https://git.kayg.org/attachments/98e9423d-c4b3-4e29-a7fc-6efbdfb4abb6). Stills: ![open](https://git.kayg.org/attachments/f5b31188-84c9-44bf-b535-8fa1dcd5aff4) ![files open](https://git.kayg.org/attachments/2649f55f-3c08-4293-92c3-1ce32ef56b1c) ![slide](https://git.kayg.org/attachments/6babe276-b47a-47ae-b090-389a2f06bf30) ### Frame times, REAL Safari on the Mac VM (macos-01), 1440x900 and 800x900, 7 drags each Method: safaridriver, real mouse actions; rAF deltas cut by phase (drag = pull to the card, hover = 760 ms rest incl. the 600 ms spring-open, drop = release + 480 ms, toast = the move toast). The idle baseline is the same length with no input. The VM runs at 60 Hz (17 ms frames), so the 8.3 ms gate cannot be read here: the column that matters is "max / frames over 25 ms" and the main-thread work per frame. | area @1440 | phase | n | p50 | p95 | max | >25 ms | |---|---|---|---|---|---|---| | Files | idle | 114 | 17 | 20 | 21 | 0 | | Files | drag | 244 | 17 | 18 | 33 | 1 | | Files | hover/open | 316 | 17 | 19 | 23 | 0 | | Files | drop | 194 | 17 | 18 | 23 | 0 | | Files | toast | 119 | 17 | 18 | 20 | 0 | | Notes | idle | 114 | 17 | 20 | 36 | 1 | | Notes | drag | 245 | 17 | 18 | 21 | 0 | | Notes | hover/open | 316 | 17 | 19 | 23 | 0 | | Notes | drop | 189 | 17 | **27** | **56** | **10** | | Notes | toast | 104 | 17 | **33** | **46** | **9** | 800 px: Files all clean (max 40 in drag, 1 frame); Notes drop p95 29 / max 54, toast p95 29 / max 43. Main-thread work per frame (p95): drag 4 ms, hover 3 ms, drop 4 ms (max 6), Files 2-3 ms. Latency: pointer past threshold to the lifted page, p50 ~27 ms; release to first slide frame ~10 ms (Files ~6 ms). Spring-open fired at 600 ms in 14/14 runs. **Honest result: NOT fully within the gate.** Files, drag, hover and open are clean. The Notes DROP still has ~10 frames over 25 ms per 7 drops, and the move toast opening costs more (45 ms). Main-thread work in those frames is only 4-6 ms, so the long frames are paint/composite (the list closing a gap and the toast glass), not script. Fixed along the way: a page-wide cursor rule (60 ms first frame), container-unit transforms, gliding every row (dozens of layers), toast in the release frame. Open: the Notes list gap closing and the toast's glass layer; next try would be moving the toast later/out of the Notes drop or `content-visibility` on rows. 120 Hz was not measurable on this VM. ### Specs (Playwright, `tests/folder-drop.spec.ts`, 390/800/1440) - Chromium: 21 passed, 6 skipped (desktop-only gestures at 390), all green. - WebKit (Linux): last full run 17 passed, 2 failed on an upper time bound for the 600 ms dwell that I then removed (no wall-clock asserts in functional specs); the re-run after that is not yet confirmed. - Covered: drop moves the item, multi-select drop moves all, Esc cancels, 600 ms hover springs open, drop on nothing returns home, touch drop at 390 (Chromium, real touches).
Author
Owner

Update 2 (head 472a998f9, slot redeployed at the same head)

Cause found by switching parts off in real Safari (Mac VM, 7-9 drags per variant):

  • The release frame: the full-viewport "grab cursor" sheet being REMOVED in the release frame cost a 30-45 ms frame on every drop (with the sheet kept or never made, the frame is gone; it is present with the slide, the pocket dip, the move and the toast all switched off, so it is not those). Fix: the sheet stops catching the pointer at release and is removed 300 ms later.
  • The move frames (~180 and ~230 ms) and the toast frames (~510 and ~550 ms): with the toast off the 510/550 pair is gone; with the move off the 180/230 pair is gone; the toast's own spring (width/height of a backdrop-blurred shape, in the shared ToastCapsule) is the heavy part and I did NOT change that shared component here. The gap-close was already FLIP (transform only, cards on screen, max 9, WAAPI promotes them only while they animate); switching it off changed little. No glass ancestor gets filter/opacity at rest (the only filters live on the dragged page's own layers).
  • The VM is noisy and a COLD page costs more: a repeat in the same session (page already loaded once, toast already created) is much cleaner than the first. Cold vs warm below.

Frame table, real Safari, 60 Hz VM, 1440x900, 7 drags (ms; ">25" = frames over 25 ms):

area phase n p50 p95 max >25
Files idle 114 17 21 24 0
Files drag 243 17 18 40 1
Files hover/open 316 17 19 24 0
Files drop 195 17 18 21 0
Files toast 100 17 19 25 0
Notes (cold) idle 113 17 19 27 1
Notes (cold) drag 246 17 18 20 0
Notes (cold) hover/open 316 17 19 23 0
Notes (cold) drop 185 17 20 56 4
Notes (cold) toast 97 17 24 52 5

Notes at 800: drop p95 19 / max 49 (4 long), toast p95 31 / max 41 (9 long). Files at 800: 1 long frame in total (27 ms).
Notes, same session after the first load ("warm"): 7 drops, 5 frames over 25 ms in total, max 40 (sidebar hidden: 4, max 33).
Main-thread script per frame (p95): Files 2 ms; Notes drag 4, drop 4 (max 6), toast 4 (one 22-23 ms frame at the toast).

Result against the gate: still NOT met. Files is clean (0-1 long frames, max 40/27 once during the pull-out). The Notes release frame is fixed, but the Notes move and toast still have 4-9 long frames per 7 drops cold (max 56), 5 warm. Script is 4-6 ms, so the rest is layout/paint of the list closing up and the toast spring; main-thread+paint+composite per frame could not be read directly (safaridriver gives no timeline; Web Inspector was not drivable here), only rAF deltas and script time. Next options, each needs your call: (a) a transform-only spring for ToastCapsule (shared component), (b) for the folder drop, no toast: the card count and Undo-by-Cmd-Z only, (c) content-visibility: auto rows in the Notes list view.

Specs and checks (head 472a998f9): Chromium 21 passed / 6 skipped / 0 failed; WebKit (Linux) 19 passed / 8 skipped / 0 failed. svelte-check: apps/mockup has no svelte-check config (running web's svelte-check over it reports 631 errors repo-wide, mostly unresolved @calternal/ui modules); filtered to the files I added or touched there is no error from my code (the two Snippet-type errors at NoteList.svelte 199 and FilesPhone.svelte 88 sit on lines I did not write).

Preview: https://preview.calternal.cloud/folder-drop/ — Notes: #/note/spiti?list=folders&view=list, Files: #/files/documents/taxes/2026?view=grid.

## Update 2 (head 472a998f9, slot redeployed at the same head) **Cause found by switching parts off in real Safari (Mac VM, 7-9 drags per variant):** - The release frame: the full-viewport "grab cursor" sheet being REMOVED in the release frame cost a 30-45 ms frame on every drop (with the sheet kept or never made, the frame is gone; it is present with the slide, the pocket dip, the move and the toast all switched off, so it is not those). Fix: the sheet stops catching the pointer at release and is removed 300 ms later. - The move frames (~180 and ~230 ms) and the toast frames (~510 and ~550 ms): with the toast off the 510/550 pair is gone; with the move off the 180/230 pair is gone; the toast's own spring (width/height of a backdrop-blurred shape, in the shared ToastCapsule) is the heavy part and I did NOT change that shared component here. The gap-close was already FLIP (transform only, cards on screen, max 9, WAAPI promotes them only while they animate); switching it off changed little. No glass ancestor gets filter/opacity at rest (the only filters live on the dragged page's own layers). - The VM is noisy and a COLD page costs more: a repeat in the same session (page already loaded once, toast already created) is much cleaner than the first. Cold vs warm below. **Frame table, real Safari, 60 Hz VM, 1440x900, 7 drags (ms; ">25" = frames over 25 ms):** | area | phase | n | p50 | p95 | max | >25 | |---|---|---|---|---|---|---| | Files | idle | 114 | 17 | 21 | 24 | 0 | | Files | drag | 243 | 17 | 18 | 40 | 1 | | Files | hover/open | 316 | 17 | 19 | 24 | 0 | | Files | drop | 195 | 17 | 18 | 21 | 0 | | Files | toast | 100 | 17 | 19 | 25 | 0 | | Notes (cold) | idle | 113 | 17 | 19 | 27 | 1 | | Notes (cold) | drag | 246 | 17 | 18 | 20 | 0 | | Notes (cold) | hover/open | 316 | 17 | 19 | 23 | 0 | | Notes (cold) | drop | 185 | 17 | 20 | 56 | 4 | | Notes (cold) | toast | 97 | 17 | 24 | 52 | 5 | Notes at 800: drop p95 19 / max 49 (4 long), toast p95 31 / max 41 (9 long). Files at 800: 1 long frame in total (27 ms). Notes, same session after the first load ("warm"): 7 drops, 5 frames over 25 ms in total, max 40 (sidebar hidden: 4, max 33). Main-thread script per frame (p95): Files 2 ms; Notes drag 4, drop 4 (max 6), toast 4 (one 22-23 ms frame at the toast). **Result against the gate: still NOT met.** Files is clean (0-1 long frames, max 40/27 once during the pull-out). The Notes release frame is fixed, but the Notes move and toast still have 4-9 long frames per 7 drops cold (max 56), 5 warm. Script is 4-6 ms, so the rest is layout/paint of the list closing up and the toast spring; main-thread+paint+composite per frame could not be read directly (safaridriver gives no timeline; Web Inspector was not drivable here), only rAF deltas and script time. Next options, each needs your call: (a) a transform-only spring for ToastCapsule (shared component), (b) for the folder drop, no toast: the card count and Undo-by-Cmd-Z only, (c) `content-visibility: auto` rows in the Notes list view. **Specs and checks (head 472a998f9):** Chromium 21 passed / 6 skipped / 0 failed; WebKit (Linux) 19 passed / 8 skipped / 0 failed. svelte-check: `apps/mockup` has no svelte-check config (running web's svelte-check over it reports 631 errors repo-wide, mostly unresolved `@calternal/ui` modules); filtered to the files I added or touched there is no error from my code (the two Snippet-type errors at NoteList.svelte 199 and FilesPhone.svelte 88 sit on lines I did not write). Preview: https://preview.calternal.cloud/folder-drop/ — Notes: `#/note/spiti?list=folders&view=list`, Files: `#/files/documents/taxes/2026?view=grid`.
Author
Owner

Update 3 (head 161b48fbb, slot redeployed at it)

Changes

  1. Shared packages/ui/.../toast/ToastCapsule.svelte: the glass box is always its FINAL size and is only scaled (transform: scale(sx, sy), from the same springs as before); no width/height on a backdrop-blurred box any more. The dot is the capsule scaled to a 12 px height (round corners), the transform is removed at rest (nothing stays promoted), the words' clip follows the same springs as before. Resizes (the count rolling, "moved" -> "Undone") are a scale from the old size to the new one.
  2. content-visibility: auto on the Notes list rows: the list VIEW (NotesListView) ALREADY had it (li, auto 68px), so the move cost was not that; I added it to the ordinary list (NoteList, auto 62px, not the gallery cards). New spec: scroll position holds (no jump, no drift scrolling 0 <-> 600) and keyboard focus stays on the row Tab reaches.

Port note for apps/web: apps/web shows toasts with the same shared package (@calternal/ui/primitives/toast: App.svelte, BottomBar, bar/Toast.svelte, lib/actions.ts), so it gets the new ToastCapsule when it takes the package. Anything in apps/web that draws its own capsule glass by width/height needs the same change; the grep shows only bar/Toast.svelte (the in-bar toast, #145), which should be checked separately.

Other toast users, before/after at rest (2x, Chromium, light): the move toast, the "Undone" state after Undo, and the multi-item move ("3 notes moved to Travel") are BYTE-IDENTICAL PNGs before (472a998f9) and after (161b48fbb). Frame times of the move and the Undo/"Undone" resize are in the table (phases toast and undo). Share/copy toasts use the same capsule and the same two code paths (open, resize); I did not drive them separately.

Frame table, real Safari, 60 Hz VM, 7 drags per row (ms; "> 25" = frames over 25 ms). Cold = first page load of the session (thumbnail snapshots are still being generated, an app-wide cost); warm = a reload in the same session.

Files (cold, then 800 cold): idle p95 20 | drag p95 19 max 49, 1 long | hover p95 19, 0 | drop p95 18 max 29, 1 long | toast p95 18 max 20, 0 | undo p95 19 max 24, 0. At 800: drag 1 long (32), drop 0, toast 0, undo 0 (max 23).

Notes 1440 phase p50 p95 max >25
cold drop 17 26 73 11
cold toast 17 19 59 1
cold undo 17 21 32 6
warm 1 drop 17 24 74 9
warm 1 toast 17 19 20 0
warm 1 undo 17 21 33 8
warm 2 drop 17 19 33 3
warm 2 toast 17 19 20 0
warm 2 undo 17 20 24 0
Notes 800 phase p50 p95 max >25
cold drop 17 20 58 9
cold toast 17 19 33 2
cold undo 17 20 28 2
warm 1 drop 17 19 25 0
warm 1 toast 17 18 21 0
warm 1 undo 17 20 41 2
warm 2 drop 17 20 32 4
warm 2 toast 17 19 24 0
warm 2 undo 17 21 29 7

Before this change the toast phase had 5-9 long frames per 7 drops (p95 24-33, max 52); now 0-2 (p95 18-19) apart from one 59 ms frame in the cold 1440 run. The toast spring is fixed.

Not at 0 yet. The Notes DROP still has long frames in cold and some warm runs (0-11 per 7 drops, max 73 at ~180-250 ms into the drop, i.e. when the list closes up and the thumbnails of the moved note are laid out). Also seen: isolated 200-320 ms stalls during idle/hover (VM noise; the idle baseline in the same runs has 1-3 frames of 26-35 ms). The "undo" resize path still shows up to 8 frames of 26-41 ms (the note returning to the list). Not fixed: that needs the list/thumbnail work, not the toast; the next step would be to measure it with the sidebar hidden and thumbnails off (an earlier A/B suggested the cold cost is thumbnail snapshots, which is an app-wide cost, not this feature's).

Specs: Chromium 22 passed / 6 skipped / 0 failed; WebKit (Linux) 20 passed / 8 skipped / 0 failed (390/800/1440, includes the new content-visibility spec).

## Update 3 (head 161b48fbb, slot redeployed at it) **Changes** 1. Shared `packages/ui/.../toast/ToastCapsule.svelte`: the glass box is always its FINAL size and is only scaled (`transform: scale(sx, sy)`, from the same springs as before); no width/height on a backdrop-blurred box any more. The dot is the capsule scaled to a 12 px height (round corners), the transform is removed at rest (nothing stays promoted), the words' clip follows the same springs as before. Resizes (the count rolling, "moved" -> "Undone") are a scale from the old size to the new one. 2. `content-visibility: auto` on the Notes list rows: the list VIEW (`NotesListView`) ALREADY had it (`li`, `auto 68px`), so the move cost was not that; I added it to the ordinary list (`NoteList`, `auto 62px`, not the gallery cards). New spec: scroll position holds (no jump, no drift scrolling 0 <-> 600) and keyboard focus stays on the row Tab reaches. **Port note for apps/web:** `apps/web` shows toasts with the same shared package (`@calternal/ui/primitives/toast`: App.svelte, BottomBar, bar/Toast.svelte, lib/actions.ts), so it gets the new ToastCapsule when it takes the package. Anything in apps/web that draws its own capsule glass by width/height needs the same change; the grep shows only `bar/Toast.svelte` (the in-bar toast, #145), which should be checked separately. **Other toast users, before/after at rest (2x, Chromium, light):** the move toast, the "Undone" state after Undo, and the multi-item move ("3 notes moved to Travel") are BYTE-IDENTICAL PNGs before (472a998f9) and after (161b48fbb). Frame times of the move and the Undo/"Undone" resize are in the table (phases `toast` and `undo`). Share/copy toasts use the same capsule and the same two code paths (open, resize); I did not drive them separately. **Frame table, real Safari, 60 Hz VM, 7 drags per row (ms; "> 25" = frames over 25 ms).** Cold = first page load of the session (thumbnail snapshots are still being generated, an app-wide cost); warm = a reload in the same session. Files (cold, then 800 cold): idle p95 20 | drag p95 19 max 49, 1 long | hover p95 19, 0 | drop p95 18 max 29, 1 long | toast p95 18 max 20, 0 | undo p95 19 max 24, 0. At 800: drag 1 long (32), drop 0, toast 0, undo 0 (max 23). | Notes 1440 | phase | p50 | p95 | max | >25 | |---|---|---|---|---|---| | cold | drop | 17 | 26 | 73 | 11 | | cold | toast | 17 | 19 | 59 | 1 | | cold | undo | 17 | 21 | 32 | 6 | | warm 1 | drop | 17 | 24 | 74 | 9 | | warm 1 | toast | 17 | 19 | 20 | 0 | | warm 1 | undo | 17 | 21 | 33 | 8 | | warm 2 | drop | 17 | 19 | 33 | 3 | | warm 2 | toast | 17 | 19 | 20 | 0 | | warm 2 | undo | 17 | 20 | 24 | 0 | | Notes 800 | phase | p50 | p95 | max | >25 | |---|---|---|---|---|---| | cold | drop | 17 | 20 | 58 | 9 | | cold | toast | 17 | 19 | 33 | 2 | | cold | undo | 17 | 20 | 28 | 2 | | warm 1 | drop | 17 | 19 | 25 | 0 | | warm 1 | toast | 17 | 18 | 21 | 0 | | warm 1 | undo | 17 | 20 | 41 | 2 | | warm 2 | drop | 17 | 20 | 32 | 4 | | warm 2 | toast | 17 | 19 | 24 | 0 | | warm 2 | undo | 17 | 21 | 29 | 7 | Before this change the toast phase had 5-9 long frames per 7 drops (p95 24-33, max 52); now 0-2 (p95 18-19) apart from one 59 ms frame in the cold 1440 run. The toast spring is fixed. **Not at 0 yet.** The Notes DROP still has long frames in cold and some warm runs (0-11 per 7 drops, max 73 at ~180-250 ms into the drop, i.e. when the list closes up and the thumbnails of the moved note are laid out). Also seen: isolated 200-320 ms stalls during idle/hover (VM noise; the idle baseline in the same runs has 1-3 frames of 26-35 ms). The "undo" resize path still shows up to 8 frames of 26-41 ms (the note returning to the list). Not fixed: that needs the list/thumbnail work, not the toast; the next step would be to measure it with the sidebar hidden and thumbnails off (an earlier A/B suggested the cold cost is thumbnail snapshots, which is an app-wide cost, not this feature's). **Specs:** Chromium 22 passed / 6 skipped / 0 failed; WebKit (Linux) 20 passed / 8 skipped / 0 failed (390/800/1440, includes the new content-visibility spec).
Author
Owner

Design note: a simpler drop path (round 4 stop-and-think)

A/B result (real Safari, 1440, 7 drags, cold = first invocation, warm = second; Notes drop phase):

variant cold: drop >25 ms / max cold: toast >25 warm: drop >25 / max warm: toast >25
base 5 / 79 1 3 / 53 1
sidebar hidden 2 / 35 0 1 / 26 0
thumbnails off (want() is a no-op) 3 / 31 0 0 / 25 0
both off (no long frame after the release) 0 (none) -

The two frames at ~180 and ~230 ms after the drop and the toast's mount frame at ~510 ms all vanish when EITHER the sidebar is hidden OR thumbnails are off. A move does not change a note's snapshot key (edit time, theme, block count), so it is not a re-capture of the moved note. What is left is the snapshot QUEUE (lib/thumbs.svelte.ts): it captures one note per idle slice (40-90 ms each: mount the page top, draw it into an SVG picture, rasterise), and it does not know a drag is on. Hiding the sidebar shrinks the queue (about 18 fewer wanted notes), switching thumbnails off empties it: that is the same finding. The slices simply land in the drop's frames (they are idle slices, so they run exactly when the page looks idle: during the slide). It also explains why "cold" is worse (the queue is full) and why every earlier fix moved the long frames around without removing them.

Simpler path (one rule, no more timing patches): nothing heavy runs while a drag is on or for ~1.1 s after it.

  1. The drag state is the single source of truth: dnd.type is set from lift to release, and the release stamps dragWatch.until = now + 1100 ms. The snapshot queue checks both and re-arms itself 400 ms later (the same way it already waits one second after a key press). Captures already running finish; none start. Nothing else about the drop changes: the move is ONE store write at +150 ms, the page slides on the compositor, the cards glide by FLIP (transform only), the toast comes at +480 ms, Undo reverses the same store write.
  2. Not done, on purpose: moving the same DOM node and keeping a bitmap, FLIP for every row, a second undo transform. The A/B shows none of them is where the frames go (script for the move is 4-6 ms, the reflow already glides only a few cards), so they would add code for no measured gain. If the table below still shows long frames after (1), the next suspect is the sidebar's recompute of every list on the store write, not the drop path.

Expected frame cost per phase after (1) (main-thread work + layout/paint, 60 Hz VM): pull-out/drag: script 2-4 ms, nothing else; hover/open: 1-3 ms; release: <= 8 ms (slide start, pocket dip, sheet kept); move + flush (+150 ms): script ~6 ms plus one list/sidebar layout, 12-16 ms in one frame; toast mount (+480 ms): <= 12 ms; no 40-90 ms capture slice between lift and +1100 ms. Target: 0 frames > 25 ms warm, at most 1 cold.

## Design note: a simpler drop path (round 4 stop-and-think) **A/B result (real Safari, 1440, 7 drags, cold = first invocation, warm = second; Notes drop phase):** | variant | cold: drop >25 ms / max | cold: toast >25 | warm: drop >25 / max | warm: toast >25 | |---|---|---|---|---| | base | 5 / 79 | 1 | 3 / 53 | 1 | | sidebar hidden | 2 / 35 | 0 | 1 / 26 | 0 | | thumbnails off (`want()` is a no-op) | 3 / 31 | 0 | 0 / 25 | 0 | | both off | (no long frame after the release) | 0 | (none) | - | The two frames at ~180 and ~230 ms after the drop and the toast's mount frame at ~510 ms all vanish when EITHER the sidebar is hidden OR thumbnails are off. A move does not change a note's snapshot key (edit time, theme, block count), so it is not a re-capture of the moved note. What is left is the snapshot QUEUE (`lib/thumbs.svelte.ts`): it captures one note per idle slice (40-90 ms each: mount the page top, draw it into an SVG picture, rasterise), and it does not know a drag is on. Hiding the sidebar shrinks the queue (about 18 fewer wanted notes), switching thumbnails off empties it: that is the same finding. The slices simply land in the drop's frames (they are idle slices, so they run exactly when the page looks idle: during the slide). It also explains why "cold" is worse (the queue is full) and why every earlier fix moved the long frames around without removing them. **Simpler path (one rule, no more timing patches):** nothing heavy runs while a drag is on or for ~1.1 s after it. 1. The drag state is the single source of truth: `dnd.type` is set from lift to release, and the release stamps `dragWatch.until = now + 1100 ms`. The snapshot queue checks both and re-arms itself 400 ms later (the same way it already waits one second after a key press). Captures already running finish; none start. Nothing else about the drop changes: the move is ONE store write at +150 ms, the page slides on the compositor, the cards glide by FLIP (transform only), the toast comes at +480 ms, Undo reverses the same store write. 2. Not done, on purpose: moving the same DOM node and keeping a bitmap, FLIP for every row, a second undo transform. The A/B shows none of them is where the frames go (script for the move is 4-6 ms, the reflow already glides only a few cards), so they would add code for no measured gain. If the table below still shows long frames after (1), the next suspect is the sidebar's recompute of every list on the store write, not the drop path. **Expected frame cost per phase after (1) (main-thread work + layout/paint, 60 Hz VM):** pull-out/drag: script 2-4 ms, nothing else; hover/open: 1-3 ms; release: <= 8 ms (slide start, pocket dip, sheet kept); move + flush (+150 ms): script ~6 ms plus one list/sidebar layout, 12-16 ms in one frame; toast mount (+480 ms): <= 12 ms; no 40-90 ms capture slice between lift and +1100 ms. Target: 0 frames > 25 ms warm, at most 1 cold.
Author
Owner

Update 4 (head 6fb0c71b5, slot redeployed at it): the drag-aware thumbnail queue

Implemented the note above in one pass, and only that: lib/thumbs.svelte.ts starts no snapshot while dnd.type is set or within 1100 ms of a release (dragWatch in press/drag.svelte.ts, which the queue reads; same pattern as its existing "one second after a key" wait). Nothing else in the drop path changed.

Result (real Safari, 60 Hz VM, 7 drags per row; ms; ">25" = frames over 25 ms)

Files, 1440, fresh session: idle p95 21 | drag p95 18 max 38 (1 long) | hover p95 19 (0) | drop p95 18 max 25 (0) | toast p95 18 max 19 (0) | undo p95 20 max 27 (1).

Notes run drop p95 drop max drop >25 toast >25 undo >25
1440, first page of a fresh session, 1.2 s settle cold 22 60 8 0 2
1440, after a 15 s settle (queue drained) cold 21 54 3 0 0
1440, 2nd page load, same session warm 20 32 6 0 2
1440, 3 loads (earlier run) warm 20 / 20 29 / 31 4 / 4 0 / 0 4 / 3
800, fresh, 1.2 s settle cold 23 41 8 0 1
800, 2nd and 3rd load warm 18 / 18 28 / 23 2 / 0 0 / 0 0 / 0
800, after a 15 s settle cold / warm 23 / 20 53 / 35 6 / 7 0 / 0 6 / 8
  • The toast phase now has 0 long frames in every run (was 1-9 before the toast and queue changes); the toast's mount frame at ~510 ms is gone.
  • The remaining long frames of the Notes drop are of two kinds: (a) cold (the first page of a fresh browser session): a pair of frames at ~+180 and ~+235 ms after the release, 30-35 and 50-60 ms, on every drop; (b) warm: mostly 26-35 ms frames, i.e. one missed vsync (the idle baseline in the same runs has frames of 22-33 ms, max 33, so this is at the VM's noise floor, not above it).
  • Target NOT met: 0 long frames warm is not reached (best runs: 0, 1, 2 per 7 drops; typical 4-7 at 1440), and cold has up to 8, not at most 1.

Why I stop here (three rounds that each found a new cause): the queue guard removed what the A/B named (capture slices landing in the drop's frames; the toast mount frame). The cold pair at +180/+235 ms survives a 15 s settle, so it is not the queue; it repeats on every drop of a fresh session and vanishes on the next page load in the same session, which points at a once-per-page cost the drop triggers (the sidebar and list recompute of every list on the store write, with a cold decode/style cache), not something the drop path adds. The next step is a profile of the move's recompute (a Safari Web Inspector timeline, which safaridriver cannot give me here), or making the Notes store write cheaper (the sidebar derives every collection's and folder's listNotes and arrange on any placed change). That is app-wide, not part of this feature, so it needs your decision.

Specs (head 6fb0c71b5): Chromium 22 passed / 6 skipped / 0 failed; WebKit (Linux) 20 passed / 8 skipped / 0 failed. Preview: https://preview.calternal.cloud/folder-drop/ (Notes #/note/spiti?list=folders&view=list, Files #/files/documents/taxes/2026?view=grid).

## Update 4 (head 6fb0c71b5, slot redeployed at it): the drag-aware thumbnail queue Implemented the note above in one pass, and only that: `lib/thumbs.svelte.ts` starts no snapshot while `dnd.type` is set or within 1100 ms of a release (`dragWatch` in `press/drag.svelte.ts`, which the queue reads; same pattern as its existing "one second after a key" wait). Nothing else in the drop path changed. **Result (real Safari, 60 Hz VM, 7 drags per row; ms; ">25" = frames over 25 ms)** Files, 1440, fresh session: idle p95 21 | drag p95 18 max 38 (1 long) | hover p95 19 (0) | drop p95 18 max 25 (0) | toast p95 18 max 19 (0) | undo p95 20 max 27 (1). | Notes | run | drop p95 | drop max | drop >25 | toast >25 | undo >25 | |---|---|---|---|---|---|---| | 1440, first page of a fresh session, 1.2 s settle | cold | 22 | 60 | 8 | 0 | 2 | | 1440, after a 15 s settle (queue drained) | cold | 21 | 54 | 3 | 0 | 0 | | 1440, 2nd page load, same session | warm | 20 | 32 | 6 | 0 | 2 | | 1440, 3 loads (earlier run) | warm | 20 / 20 | 29 / 31 | 4 / 4 | 0 / 0 | 4 / 3 | | 800, fresh, 1.2 s settle | cold | 23 | 41 | 8 | 0 | 1 | | 800, 2nd and 3rd load | warm | 18 / 18 | 28 / 23 | 2 / 0 | 0 / 0 | 0 / 0 | | 800, after a 15 s settle | cold / warm | 23 / 20 | 53 / 35 | 6 / 7 | 0 / 0 | 6 / 8 | - The toast phase now has **0 long frames in every run** (was 1-9 before the toast and queue changes); the toast's mount frame at ~510 ms is gone. - The remaining long frames of the Notes drop are of two kinds: (a) **cold** (the first page of a fresh browser session): a pair of frames at ~+180 and ~+235 ms after the release, 30-35 and 50-60 ms, on every drop; (b) **warm**: mostly 26-35 ms frames, i.e. one missed vsync (the idle baseline in the same runs has frames of 22-33 ms, max 33, so this is at the VM's noise floor, not above it). - **Target NOT met**: 0 long frames warm is not reached (best runs: 0, 1, 2 per 7 drops; typical 4-7 at 1440), and cold has up to 8, not at most 1. **Why I stop here (three rounds that each found a new cause):** the queue guard removed what the A/B named (capture slices landing in the drop's frames; the toast mount frame). The cold pair at +180/+235 ms survives a 15 s settle, so it is not the queue; it repeats on every drop of a fresh session and vanishes on the next page load in the same session, which points at a once-per-page cost the drop triggers (the sidebar and list recompute of every list on the store write, with a cold decode/style cache), not something the drop path adds. The next step is a profile of the move's recompute (a Safari Web Inspector timeline, which safaridriver cannot give me here), or making the Notes store write cheaper (the sidebar derives every collection's and folder's `listNotes` and `arrange` on any `placed` change). That is app-wide, not part of this feature, so it needs your decision. **Specs (head 6fb0c71b5):** Chromium 22 passed / 6 skipped / 0 failed; WebKit (Linux) 20 passed / 8 skipped / 0 failed. Preview: https://preview.calternal.cloud/folder-drop/ (Notes `#/note/spiti?list=folders&view=list`, Files `#/files/documents/taxes/2026?view=grid`).
Author
Owner

Update 5 (head 199db43a1, slot redeployed at it): incremental folder store, measured, and what it showed

Change (one focused commit): lib/folders.svelte.ts keeps an INDEX instead of asking every note where it lives: a member set per folder (direct) and a set of live paths (live), both updated by moveTo (it touches only the folder a note leaves and the one it enters). listNotes('folder:x') reads only the sets of x's own branch (folderIds), the folder tree rebuilds only when a folder gains its first note or loses its last (or a note is made or deleted), and the save (JSON.stringify(placed) + localStorage, a synchronous disk write in Safari) waits for idle or pagehide. Collections never read this state, so a move already recomputed only the folder-dependent derivations; this makes THOSE O(branch) instead of O(all folders x all notes). Sidebar counts still come from the lists (visibility filters differ from raw set size), so they are not a separate delta.

Recompute cost per move, performance.measure("note-move") around the write and the update it causes (ms per move):

browser before (8d753bc2d) after (199db43a1)
Safari (Mac VM, 7 moves, x2) total 1-6 (median 2), write 0-1 total 1-3 (median 2), write 0-1
Chromium (dev-01, 10 moves, no throttle) total 8.5-29 (median ~18), write 0.2-4.2 total 8-36 (median ~25), write 0.1-0.3

(Safari's timer is 1 ms resolution, so these are coarse; Chromium on the shared build host is noisy.) No measurable gain: the recompute was never the cost. The Chromium CPU profile of a move (top self time, average of 3 moves, ms): offsetWidth 22, remove() 14, getBoundingClientRect 8, offsetHeight 5, querySelector 4; the Svelte reaction code (get, reconcile, update_reaction, destroy_*) is 2-3 ms each, ~15 ms together. The big items are FORCED SYNCHRONOUS LAYOUTS: the toast's fit() reads inner.offsetWidth/offsetHeight as it mounts (and on every resize), reflow() reads getBoundingClientRect of the cards before and after the move, and the ghost's remove() lands after a layout is dirty. That matches the Safari frames at ~+180/+235 ms (the move's flush, then the reflow's measure) and the toast mount.

Notes drop table, real Safari, 7 drags (">25" = frames over 25 ms), fresh page then reload in the same session (this run was noisy: the 1440 drag phase itself shows 9-11 long frames, which the earlier runs did not):

width run drop p95 drop max drop >25 toast >25 undo >25
1440 fresh 33 74 17 0 8
1440 warm 26 38 12 0 9
800 fresh 28 54 11 0 4
800 warm 19 27 2 0 2

Same shape as before the index (the +180/+235 ms frames at 30-40 and 50-74 ms on the fresh runs; warm 800 near the noise floor). The index did not change them.

Where this leaves the drop (no more patches from me, per the three-round rule): the Notes drop's long frames are layout, not store work. The two causes the profile names are in feature code I own and are the next, small, separate change if you want it: (1) reflow() should not read getBoundingClientRect after the DOM change in the same frame it changed in (measure all cards BEFORE, apply, then measure AFTER inside one rAF, or skip the measure and animate by known card geometry); (2) the shared ToastCapsule.fit() reads offsetWidth/offsetHeight on mount and on every ResizeObserver tick (read them once per frame, from the ResizeObserver entry's borderBoxSize instead of forced layout reads). I did not change either. The index commit can be kept (it makes folder lists O(branch), which matters at 2,000 notes) or dropped without changing the table; say which.

apps/web: port item (read only, nothing changed). apps/web has NO folders (lists.ts: "Tags organise; there are no folders in the UI"), so the folder index has nothing to port, but its store has the same shape of problem for the lists it does have: store.notes is a getter that returns [...map.values()] (a NEW array of every note on every read) over a SvelteMap, and applyEntry does notesState.rev++ on every journal entry plus a map.set/map.delete, so a single edit re-runs every listNotes reader (journal, pinned, each tag) in full, and every reader copies the whole map first. Port: keep the notes array memoized (rebuilt only on add/remove, not on an edit), and keep per-list member sets (tag -> ids, pinned ids, journal ids) updated by applyEntry so a write wakes only the lists the note is in or was in (the same pattern as lib/folders.svelte.ts here). Also the in-bar toast and ToastCapsule in the shared package: the same offsetWidth reads apply.

Specs (head 199db43a1): Chromium 22 passed / 6 skipped / 0 failed; WebKit (Linux) 20 passed / 8 skipped / 0 failed. Preview: https://preview.calternal.cloud/folder-drop/ (Notes #/note/spiti?list=folders&view=list, Files #/files/documents/taxes/2026?view=grid).

## Update 5 (head 199db43a1, slot redeployed at it): incremental folder store, measured, and what it showed **Change (one focused commit):** `lib/folders.svelte.ts` keeps an INDEX instead of asking every note where it lives: a member set per folder (`direct`) and a set of live paths (`live`), both updated by `moveTo` (it touches only the folder a note leaves and the one it enters). `listNotes('folder:x')` reads only the sets of x's own branch (`folderIds`), the folder tree rebuilds only when a folder gains its first note or loses its last (or a note is made or deleted), and the save (`JSON.stringify(placed)` + `localStorage`, a synchronous disk write in Safari) waits for idle or `pagehide`. Collections never read this state, so a move already recomputed only the folder-dependent derivations; this makes THOSE O(branch) instead of O(all folders x all notes). Sidebar counts still come from the lists (visibility filters differ from raw set size), so they are not a separate delta. **Recompute cost per move, `performance.measure("note-move")` around the write and the update it causes (ms per move):** | browser | before (8d753bc2d) | after (199db43a1) | |---|---|---| | Safari (Mac VM, 7 moves, x2) | total 1-6 (median 2), write 0-1 | total 1-3 (median 2), write 0-1 | | Chromium (dev-01, 10 moves, no throttle) | total 8.5-29 (median ~18), write 0.2-4.2 | total 8-36 (median ~25), write 0.1-0.3 | (Safari's timer is 1 ms resolution, so these are coarse; Chromium on the shared build host is noisy.) **No measurable gain: the recompute was never the cost.** The Chromium CPU profile of a move (top self time, average of 3 moves, ms): `offsetWidth` 22, `remove()` 14, `getBoundingClientRect` 8, `offsetHeight` 5, `querySelector` 4; the Svelte reaction code (`get`, `reconcile`, `update_reaction`, `destroy_*`) is 2-3 ms each, ~15 ms together. The big items are FORCED SYNCHRONOUS LAYOUTS: the toast's `fit()` reads `inner.offsetWidth/offsetHeight` as it mounts (and on every resize), `reflow()` reads `getBoundingClientRect` of the cards before and after the move, and the ghost's `remove()` lands after a layout is dirty. That matches the Safari frames at ~+180/+235 ms (the move's flush, then the reflow's measure) and the toast mount. **Notes drop table, real Safari, 7 drags (">25" = frames over 25 ms), fresh page then reload in the same session (this run was noisy: the 1440 drag phase itself shows 9-11 long frames, which the earlier runs did not):** | width | run | drop p95 | drop max | drop >25 | toast >25 | undo >25 | |---|---|---|---|---|---|---| | 1440 | fresh | 33 | 74 | 17 | 0 | 8 | | 1440 | warm | 26 | 38 | 12 | 0 | 9 | | 800 | fresh | 28 | 54 | 11 | 0 | 4 | | 800 | warm | 19 | 27 | 2 | 0 | 2 | Same shape as before the index (the +180/+235 ms frames at 30-40 and 50-74 ms on the fresh runs; warm 800 near the noise floor). The index did not change them. **Where this leaves the drop (no more patches from me, per the three-round rule):** the Notes drop's long frames are layout, not store work. The two causes the profile names are in feature code I own and are the next, small, separate change if you want it: (1) `reflow()` should not read `getBoundingClientRect` after the DOM change in the same frame it changed in (measure all cards BEFORE, apply, then measure AFTER inside one rAF, or skip the measure and animate by known card geometry); (2) the shared `ToastCapsule.fit()` reads `offsetWidth/offsetHeight` on mount and on every ResizeObserver tick (read them once per frame, from the ResizeObserver entry's `borderBoxSize` instead of forced layout reads). I did not change either. The index commit can be kept (it makes folder lists O(branch), which matters at 2,000 notes) or dropped without changing the table; say which. **apps/web: port item (read only, nothing changed).** apps/web has NO folders (`lists.ts`: "Tags organise; there are no folders in the UI"), so the folder index has nothing to port, but its store has the same shape of problem for the lists it does have: `store.notes` is a getter that returns `[...map.values()]` (a NEW array of every note on every read) over a `SvelteMap`, and `applyEntry` does `notesState.rev++` on every journal entry plus a `map.set`/`map.delete`, so a single edit re-runs every `listNotes` reader (journal, pinned, each tag) in full, and every reader copies the whole map first. Port: keep the notes array memoized (rebuilt only on add/remove, not on an edit), and keep per-list member sets (tag -> ids, pinned ids, journal ids) updated by `applyEntry` so a write wakes only the lists the note is in or was in (the same pattern as `lib/folders.svelte.ts` here). Also the in-bar toast and `ToastCapsule` in the shared package: the same `offsetWidth` reads apply. **Specs (head 199db43a1):** Chromium 22 passed / 6 skipped / 0 failed; WebKit (Linux) 20 passed / 8 skipped / 0 failed. Preview: https://preview.calternal.cloud/folder-drop/ (Notes `#/note/spiti?list=folders&view=list`, Files `#/files/documents/taxes/2026?view=grid`).
Author
Owner

Update 6 (head 3be6a6830, slot redeployed at it): the two layout fixes, measured

Changes

  • folders/reflow.ts: one batched read of every rect BEFORE the change (FIRST), the change, then in the next frame ONE batched read of every rect (LAST), then only writes (animate). The old loop read a rect, started an animation and read the next, so the page could be laid out again after each animation started.
  • shared ToastCapsule.svelte: the size comes from the ResizeObserver entry (borderBoxSize, rounded as offsetWidth was); no offsetWidth/offsetHeight reads. The first observer report arrives before the first paint, so the dot is there in the first frame.
  • Index commit kept (decision 1).

Other toasts stay pixel-identical: 2x crops of the move toast, the "Undone" state after Undo and the multi-item move toast, captured with prefers-reduced-motion (the glass snaps to its rest size, so the pixels do not depend on machine load) at 199db43a1 (before) and 3be6a6830 (after): all three are BYTE-IDENTICAL PNGs. (A first attempt with the spring running showed a 1 % scale difference because the shared build host was at load 25 and the spring had not settled in 1.3 s; that is the harness, not the component.) Share/copy toasts go through the same two paths (first report, resize).

Chromium CPU profile of one drop, self time per move (ms), top forced-layout entries. The build host was at load ~25 for the "after" run, so absolute numbers are inflated; read the CALLERS, not the totals.

call before (199db43a1) after (3be6a6830) who calls it now
offsetWidth 22 0 (was the toast)
offsetHeight 5 30 all of it from svelte-sonner (its own effect measures a toast's height when it mounts: third-party, not our code)
getBoundingClientRect 8 11 reflow.ts: the ONE batched read (a layout is needed once in that frame anyway); sonner 1.3
remove 14 15 Svelte destroying the moved row's DOM (remove_effect_dom), not a layout read

So our code no longer has a forced layout in the drop except the single batched FLIP read; the remaining forced layout is svelte-sonner's own measure of the toast. Removing that means not mounting the toast in the drop's frames, or replacing sonner's height measure, which is not a small change.

Notes drop, real Safari, 7 drags (">25" = frames over 25 ms); fresh page, then reload in the same session:

width run drop p95 drop max drop >25 toast >25 undo >25
1440 fresh 29 54 11 0 1
1440 warm 29 60 10 1 (47 ms) 7
800 fresh 26 69 10 0 3
800 warm 19 31 1 0 0

(The warm 1440 run also had a 116 ms hitch during the pull-out, i.e. VM noise: its idle baseline is the same run.) No change from before: the fresh runs still show the pair at ~+178 ms and ~+230 ms (30-34 ms and 47-69 ms) on every drop. The profile says the forced layouts were real, the fixes removed ours, and the frames did not move, so the pair is not our forced layouts either. What is left at those two moments is Svelte destroying and re-creating DOM (remove_effect_dom, the keyed list and the card pages) plus the layout and paint of the list closing up, which only a Safari Web Inspector timeline can split (safaridriver cannot give it). I am stopping here; this is the fifth cause that was not the cause.

Web port issue opened: #1034 "web: store.notes full recompute on every journal entry" (apps/web findings and the proposed fix; links #1030). apps/web unchanged.

Specs (head 3be6a6830): Chromium 22 passed / 6 skipped / 0 failed; WebKit (Linux) 20 passed / 8 skipped / 0 failed.

## Update 6 (head 3be6a6830, slot redeployed at it): the two layout fixes, measured **Changes** - `folders/reflow.ts`: one batched read of every rect BEFORE the change (FIRST), the change, then in the next frame ONE batched read of every rect (LAST), then only writes (`animate`). The old loop read a rect, started an animation and read the next, so the page could be laid out again after each animation started. - shared `ToastCapsule.svelte`: the size comes from the ResizeObserver entry (`borderBoxSize`, rounded as `offsetWidth` was); no `offsetWidth`/`offsetHeight` reads. The first observer report arrives before the first paint, so the dot is there in the first frame. - Index commit kept (decision 1). **Other toasts stay pixel-identical:** 2x crops of the move toast, the "Undone" state after Undo and the multi-item move toast, captured with `prefers-reduced-motion` (the glass snaps to its rest size, so the pixels do not depend on machine load) at 199db43a1 (before) and 3be6a6830 (after): all three are BYTE-IDENTICAL PNGs. (A first attempt with the spring running showed a 1 % scale difference because the shared build host was at load 25 and the spring had not settled in 1.3 s; that is the harness, not the component.) Share/copy toasts go through the same two paths (first report, resize). **Chromium CPU profile of one drop, self time per move (ms), top forced-layout entries.** The build host was at load ~25 for the "after" run, so absolute numbers are inflated; read the CALLERS, not the totals. | call | before (199db43a1) | after (3be6a6830) | who calls it now | |---|---|---|---| | `offsetWidth` | 22 | 0 | (was the toast) | | `offsetHeight` | 5 | 30 | all of it from `svelte-sonner` (its own effect measures a toast's height when it mounts: third-party, not our code) | | `getBoundingClientRect` | 8 | 11 | `reflow.ts`: the ONE batched read (a layout is needed once in that frame anyway); sonner 1.3 | | `remove` | 14 | 15 | Svelte destroying the moved row's DOM (`remove_effect_dom`), not a layout read | So our code no longer has a forced layout in the drop except the single batched FLIP read; the remaining forced layout is svelte-sonner's own measure of the toast. Removing that means not mounting the toast in the drop's frames, or replacing sonner's height measure, which is not a small change. **Notes drop, real Safari, 7 drags (">25" = frames over 25 ms); fresh page, then reload in the same session:** | width | run | drop p95 | drop max | drop >25 | toast >25 | undo >25 | |---|---|---|---|---|---|---| | 1440 | fresh | 29 | 54 | 11 | 0 | 1 | | 1440 | warm | 29 | 60 | 10 | 1 (47 ms) | 7 | | 800 | fresh | 26 | 69 | 10 | 0 | 3 | | 800 | warm | 19 | 31 | 1 | 0 | 0 | (The warm 1440 run also had a 116 ms hitch during the pull-out, i.e. VM noise: its idle baseline is the same run.) **No change from before:** the fresh runs still show the pair at ~+178 ms and ~+230 ms (30-34 ms and 47-69 ms) on every drop. The profile says the forced layouts were real, the fixes removed ours, and the frames did not move, so the pair is not our forced layouts either. What is left at those two moments is Svelte destroying and re-creating DOM (`remove_effect_dom`, the keyed list and the card pages) plus the layout and paint of the list closing up, which only a Safari Web Inspector timeline can split (safaridriver cannot give it). I am stopping here; this is the fifth cause that was not the cause. **Web port issue opened:** #1034 "web: store.notes full recompute on every journal entry" (apps/web findings and the proposed fix; links #1030). apps/web unchanged. **Specs (head 3be6a6830):** Chromium 22 passed / 6 skipped / 0 failed; WebKit (Linux) 20 passed / 8 skipped / 0 failed.
Author
Owner

Update 7 and PARKED (last time-boxed attempt, reverted)

Tried (1609a89fa): keep the moved rows' DOM alive through the drop: at the drop the rows are only HIDDEN (visibility), everything below slides up by transform (one batched read, then writes), the card's count ticks from a local pending delta, and 400 ms later, at idle, the real store write lands, the transforms are removed in the same task and the toast follows (folders/close-up.ts, FolderGrid.drop). Chromium specs stayed green (22 passed).

Result, real Safari, 7 drags (">25" = frames over 25 ms); fresh page, then reload in the same session. NOT BETTER, reverted (see the head below):

width run drop p95 drop max drop >25 toast p95 toast >25 undo >25
1440 fresh 28 108 13 47 11 7
1440 warm 30 127 13 29 7 7
800 fresh 19 27 1 30 10 3
800 warm 20 100 5 21 2 3

(Before the attempt, at 3be6a6830: drop >25 = 11/10 at 1440, 10/1 at 800; toast 0-1.) The pair of frames at ~+180/+230 ms is gone, but the SAME work now shows up as a 35-47 ms frame at ~+580-650 ms (the deferred write, the destroy/create, the toast mount) and some 100-200 ms ones (the Mac VM was also shared with another lane's runs, so treat the maxima as noisy). The toast phase went from 0-1 long frames to 2-11. Deferring does not make the work cheaper, and the metric counts it wherever it lands, so I reverted. The branch head is the revert (tree identical to 3be6a6830).

Parked: remaining cost and next ideas

Where it stands (head, tree = 3be6a6830): Files is clean; the Notes drop has 10-13 long frames per 7 drops at 1440 (fresh and warm) and 1-10 at 800; the toast is clean (0-1); the thumbnail queue, store recompute, toast spring, reflow reads and the toast's offsetWidth are all fixed or ruled out.
Remaining cost: a pair of frames at about +178 ms (30-34 ms) and +230 ms (47-69 ms) after the release on a fresh page. It is not script (4-6 ms), not the store (2-3 ms), not our forced layouts (removed), not the queue (guarded). What is left is Svelte destroying the moved row and re-creating the card's pages and the sidebar rows, plus one layout and paint of the list closing up, with svelte-sonner's own offsetHeight measure on the toast mount (30 ms self time in a loaded Chromium profile).
Next ideas, in order:

  1. Get the real answer first: a Safari Web Inspector TIMELINE of one drop on the Mac VM (layout, paint, composite and JS split per frame). safaridriver cannot give one; drive the Web Inspector through the GUI driver (cua-driver / the guest ~/mcpgui.py, see the Mac VM GUI note) or record with xctrace / Instruments' Safari template, then read where the two frames go.
  2. If it is layout/paint of the list: give the list rows contain: layout paint and a fixed row height (a measured contain-intrinsic-size is already there), and move the moved row out with position: absolute for one frame instead of remove.
  3. If it is the sidebar tree: render the sidebar tree rows from a memo keyed on folder branch (the per-branch index already exists), or defer the sidebar's refresh to idle (it is not under the pointer during the drop).
  4. If it is sonner: replace sonner's mount with the in-bar toast path (apps/web/.../bar/Toast.svelte style) for the move toast, which has no height measure.
  5. Reduce the cost of the DOM itself: the Notes list rows each carry a thumbnail component with observers; one IntersectionObserver for the list instead of one per row.
## Update 7 and PARKED (last time-boxed attempt, reverted) **Tried (1609a89fa):** keep the moved rows' DOM alive through the drop: at the drop the rows are only HIDDEN (`visibility`), everything below slides up by transform (one batched read, then writes), the card's count ticks from a local pending delta, and 400 ms later, at idle, the real store write lands, the transforms are removed in the same task and the toast follows (`folders/close-up.ts`, `FolderGrid.drop`). Chromium specs stayed green (22 passed). **Result, real Safari, 7 drags (">25" = frames over 25 ms); fresh page, then reload in the same session. NOT BETTER, reverted (see the head below):** | width | run | drop p95 | drop max | drop >25 | toast p95 | toast >25 | undo >25 | |---|---|---|---|---|---|---|---| | 1440 | fresh | 28 | 108 | 13 | 47 | 11 | 7 | | 1440 | warm | 30 | 127 | 13 | 29 | 7 | 7 | | 800 | fresh | 19 | 27 | 1 | 30 | 10 | 3 | | 800 | warm | 20 | 100 | 5 | 21 | 2 | 3 | (Before the attempt, at 3be6a6830: drop >25 = 11/10 at 1440, 10/1 at 800; toast 0-1.) The pair of frames at ~+180/+230 ms is gone, but the SAME work now shows up as a 35-47 ms frame at ~+580-650 ms (the deferred write, the destroy/create, the toast mount) and some 100-200 ms ones (the Mac VM was also shared with another lane's runs, so treat the maxima as noisy). The toast phase went from 0-1 long frames to 2-11. Deferring does not make the work cheaper, and the metric counts it wherever it lands, so I reverted. The branch head is the revert (tree identical to 3be6a6830). ## Parked: remaining cost and next ideas **Where it stands (head, tree = 3be6a6830):** Files is clean; the Notes drop has 10-13 long frames per 7 drops at 1440 (fresh and warm) and 1-10 at 800; the toast is clean (0-1); the thumbnail queue, store recompute, toast spring, reflow reads and the toast's offsetWidth are all fixed or ruled out. **Remaining cost:** a pair of frames at about +178 ms (30-34 ms) and +230 ms (47-69 ms) after the release on a fresh page. It is not script (4-6 ms), not the store (2-3 ms), not our forced layouts (removed), not the queue (guarded). What is left is Svelte destroying the moved row and re-creating the card's pages and the sidebar rows, plus one layout and paint of the list closing up, with svelte-sonner's own `offsetHeight` measure on the toast mount (30 ms self time in a loaded Chromium profile). **Next ideas, in order:** 1. Get the real answer first: a Safari Web Inspector TIMELINE of one drop on the Mac VM (layout, paint, composite and JS split per frame). safaridriver cannot give one; drive the Web Inspector through the GUI driver (cua-driver / the guest `~/mcpgui.py`, see the Mac VM GUI note) or record with `xctrace` / Instruments' Safari template, then read where the two frames go. 2. If it is layout/paint of the list: give the list rows `contain: layout paint` and a fixed row height (a measured `contain-intrinsic-size` is already there), and move the moved row out with `position: absolute` for one frame instead of `remove`. 3. If it is the sidebar tree: render the sidebar tree rows from a memo keyed on folder branch (the per-branch index already exists), or defer the sidebar's refresh to idle (it is not under the pointer during the drop). 4. If it is sonner: replace sonner's mount with the in-bar toast path (`apps/web/.../bar/Toast.svelte` style) for the move toast, which has no height measure. 5. Reduce the cost of the DOM itself: the Notes list rows each carry a thumbnail component with observers; one IntersectionObserver for the list instead of one per row.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
kayg/calternal#1030
No description provided.