Repository navigation
perf(editor): less work per keystroke and delete; move up/down scrolls in its view and waits for a pending Enter or join - #13782
yuxi-liu-wired wants to merge 22 commits into
Conversation
|
Review note ( |
|
Thanks, fixed. |
ab45baa to
8a615e8
Compare
9dbaa84 to
7b6050e
Compare
4f8b577 to
e0fac6e
Compare
…it merges cleanly with logseq#13782 The tests this PR added to editor_test.cljs sat at the same place as the ones logseq#13782 adds there, so the two PRs conflicted and the nightly merge left one of them out. The tests are unchanged; they now live in frontend.handler.editor-fuzz-ui-test, which carries the requires and the DB fixture they need, and editor_test.cljs is back to master's.
e0fac6e to
d1ae8fc
Compare
…it merges cleanly with logseq#13782 The tests this PR added to editor_test.cljs sat at the same place as the ones logseq#13782 adds there, so the two PRs conflicted and the nightly merge left one of them out. The tests are unchanged; they now live in frontend.handler.editor-fuzz-ui-test, which carries the requires and the DB fixture they need, and editor_test.cljs is back to master's.
8e32bf6 to
c449e87
Compare
…it merges cleanly with logseq#13782 The tests this PR added to editor_test.cljs sat at the same place as the ones logseq#13782 adds there, so the two PRs conflicted and the nightly merge left one of them out. The tests are unchanged; they now live in frontend.handler.editor-fuzz-ui-test, which carries the requires and the DB fixture they need, and editor_test.cljs is back to master's.
…it merges cleanly with logseq#13782 The tests this PR added to editor_test.cljs sat at the same place as the ones logseq#13782 adds there, so the two PRs conflicted and the nightly merge left one of them out. The tests are unchanged; they now live in frontend.handler.editor-fuzz-ui-test, which carries the requires and the DB fixture they need, and editor_test.cljs is back to master's.
…it merges cleanly with logseq#13782 The tests this PR added to editor_test.cljs sat at the same place as the ones logseq#13782 adds there, so the two PRs conflicted and the nightly merge left one of them out. The tests are unchanged; they now live in frontend.handler.editor-fuzz-ui-test, which carries the requires and the DB fixture they need, and editor_test.cljs is back to master's.
7095560 to
d200912
Compare
…it merges cleanly with logseq#13782 The tests this PR added to editor_test.cljs sat at the same place as the ones logseq#13782 adds there, so the two PRs conflicted and the nightly merge left one of them out. The tests are unchanged; they now live in frontend.handler.editor-fuzz-ui-test, which carries the requires and the DB fixture they need, and editor_test.cljs is back to master's.
30f93de to
8b7997b
Compare
…it merges cleanly with logseq#13782 The tests this PR added to editor_test.cljs sat at the same place as the ones logseq#13782 adds there, so the two PRs conflicted and the nightly merge left one of them out. The tests are unchanged; they now live in frontend.handler.editor-fuzz-ui-test, which carries the requires and the DB fixture they need, and editor_test.cljs is back to master's.
…it merges cleanly with logseq#13782 The tests this PR added to editor_test.cljs sat at the same place as the ones logseq#13782 adds there, so the two PRs conflicted and the nightly merge left one of them out. The tests are unchanged; they now live in frontend.handler.editor-fuzz-ui-test, which carries the requires and the DB fixture they need, and editor_test.cljs is back to master's.
8b7997b to
62ca7d7
Compare
…it merges cleanly with logseq#13782 The tests this PR added to editor_test.cljs sat at the same place as the ones logseq#13782 adds there, so the two PRs conflicted and the nightly merge left one of them out. The tests are unchanged; they now live in frontend.handler.editor-fuzz-ui-test, which carries the requires and the DB fixture they need, and editor_test.cljs is back to master's.
955b672 to
39bec4f
Compare
…store Every keystroke wrote four values through state/set-state!: the block text, the last input time, the last key code, and the saved cursor position. Each write makes the state store re-evaluate every mounted subscription, so on a page with many blocks a keystroke ran that sweep four times. The last input time, the last key code, the saved cursor, and the UI's last key code are read imperatively by the editor handlers through their getters; no component subscribes to them. Keep them in plain atoms, remove their keys from the store's initial state and from the places that reset them, and drop the store save/restore of the saved cursor from state_test. A keystroke now writes the store once, for the text. Measured on a 2,000-page graph, typing into a block on a 204 KB page (key press to next frame, p50 / p90 / max, 83 keys): before 44.7 / 50.7 / 66.3 ms, after this change 34.9 / 49.5 / 88.3 ms.
:editor/last-key-code was only ever written, never read (the store key had no getter; the keyup handler stored a map that nothing consumed). Keeping it as a private atom preserves dead bookkeeping, so remove the atom, the setter, and its call sites entirely.
state/set-state! and state/update-state! know which app-db path they change, and frontend.state registers every state key k as a subscription [k & path] reading (get-in (get db k) path). Tell the rfx store both facts: bind store/*changed-paths* around next-state! and install a sub-key fn that maps [k & path] to [k (first path)] and [::state-key k] to [k nil]. The store then evicts and recomputes only the subscriptions reading those paths on each write instead of every mounted subscription. Writes without a path (swap-state!, event :db effects) are handled by the store's two-level comparison of the previous and next db. Depends on the rfx change "Recompute only the subscriptions that read a changed app-db path"; deps.edn points at that commit on the fork and will be repointed to upstream rfx once that change merges. Measured on a 2,000-page graph, on a 204 KB page: moving the editing cursor between blocks with ArrowDown/ArrowUp (key press to next frame, p50 / p90 / max) 44.4 / 50.2 / 76.5 ms before, 20.8 / 31.2 / 47 ms after the full set of changes; a click into a block paints after 48 ms instead of 160 ms; long tasks over 50 ms during 40 block moves: 38 before, 0 after.
set-state! took a :changed-paths option that no caller passes; replace-state! already reports the written path to the store.
Deleting selected blocks read them from the worker first, only to keep the top-level blocks and to skip a selection of recycle roots. The op now carries the selected ids with a :selection option and the worker resolves it inside :delete-blocks into the ops the window used to send, so the recorded ops are unchanged. The editor moves to the block above when the op is sent instead of when the worker replies; the deleted rows still leave when the delta arrives.
Moving a block with Shift+Alt+Down past the bottom edge of the window left it below the edge: the move scrolled the block into view before the move was applied, at the block's old place, which was still on screen. Moving up worked by luck: the block's old place at the top edge was already partly off screen. Scroll once the move is applied and the block is drawn in its new place.
The scroll ran on the next frame after the move, whatever page was open by then, on the block's first row in the document, which can be a copy in an embed or the sidebar. It now runs only if the graph and route are unchanged, on the row in the container the block was moved in.
…/Delete join Enter inserts a block, and Backspace at the start of a block (or Delete at the end of one) joins two blocks, in steps that each wait on the db worker; only the last step moves the editor to the new or joined block. Until then the edit state names the block that was split or deleted. A move pressed in between took that block: - right after a Backspace join, the move was for the deleted block and nothing moved; - right after Enter at the end of c, the move moved c instead of the new empty block (Down: c below the new block; Up: c above b). The pending Enter now carries a promise that settles when it has moved the editor (or failed), a running join is recorded the same way, and move-up-down waits for both before it takes the edited block. With neither running, the move starts as before.
…ding from its keydown - The insert's transaction skips the editor callback when the route or graph changed meanwhile; the Enter then never ended, Enter stayed blocked and moves waited for good. It now ends once the transaction is done when its callback did not run; a token keeps an earlier Enter from ending a later one. - Backspace / Delete looked up the previous / next block before the join was registered, so a move during the lookup did not wait. The join is now tracked from its keydown.
The scroll after a move took get-first-block-by-id, the block's first row in document order: with the same block drawn earlier in an embed or a query, that copy was scrolled instead. The move now passes the container of the edited row, or of the selection, through to the scroll.
…spaces
Keys typed between Enter and the new block's insert landing are buffered as the pending block's typed-text, then handed to edit-block! as :custom-content with the cursor after them. set-editing! trimmed every content and wrote it into the textarea, so typed-text ending in a space ("rapid ") lost it under the cursor and the next keys joined the word ("rapidenter alpha"), the failure `consecutive-enter-keeps-text-and-cursor-on-the-new-block` shows at random in CI. set-editing! takes :keep-whitespace?, which the three edit-block! calls of inserted-block-edit-fn pass.
Pressing ArrowDown within 450 ms of the last keystroke in a page title whose new name is taken (e.g. "page 2" edited to "page" while a page "page" exists) sent the save twice and showed the "Another page named ..." warning twice. Every keystroke schedules a 450 ms auto-save (edit-box-on-change!). move-cross-boundary-up-down saves the editor text with save-block! directly, which, unlike save-current-block!, does not cancel that timer. When the save is refused the editor stays in the title, so the timer fires and saves the same refused text again. When the save is accepted the timer's save finds nothing changed, so accepted title edits and ordinary block edits sent one save already. move-cross-boundary-up-down now clears the pending auto-save before its own save, since that save replaces it. The regression test schedules the auto-save through edit-box-on-change!, refuses the ArrowDown save and checks that one save goes out; before the change the auto-save went out as well.
Ctrl+Up/Down on a block that isn't in the db, e.g. right after Enter
while the new block's insert hasn't landed, or on a block just deleted,
failed the whole transaction with "DB write failed with invalid data".
A local key fuzzer found it (Enter, Ctrl+Down, typing, Backspace, Ctrl+Up
with no wait between them).
The :collapse-expand-blocks op transacts the frontend's
{:block/uuid :block/collapsed?} maps as they come. For a uuid that isn't
in the db that creates a bare entity with only those two attributes,
which fails validation as a block without title, parent, order and page.
The op now drops the maps whose block doesn't exist, as the move and
indent/outdent ops next to it already do, and transacts nothing when
none is left.
collapse-expand-blocks-op-skips-missing-blocks (deps/outliner op-test)
collapses a missing block together with an existing one: before the
change it fails with "DB write failed with invalid data"; after it the
existing block collapses and no entity is created for the missing one.
ArrowUp from the first block of a journal page opened the journal's
title in the editor. A click on the title doesn't (it is date-derived and
read-only), and neither does Backspace into it, which selects the title
(previous-block-edit). Edits made there were refused by the worker
("journal page protected attr updated") while the editor stayed in the
title. A local key fuzzer found it: it turned "Oct 25th, 2026" into
"Oct 2th, 2026".
move-cross-boundary-up-down now checks a page-title target: when its
page is a journal, the title is selected instead of edited, as on
Backspace. Other page titles are edited as before; the lookup only runs
when the target is a page title.
arrow-up-into-a-journal-title-selects-it-test runs ArrowUp into a
journal's title (selected) and into an ordinary page's title (edited);
before the change the journal's title was edited.
A key fuzzer pasted one block three times with a nil title and the worker
refused the paste: Datascript merged the three inserts into one untitled
entity and validation rejected the whole transaction.
Copying is asynchronous. <get-all-blocks-by-ids first loads the selected
blocks, then fetches each block's tree. When the blocks are deleted in
between (Control+c followed at once by Backspace or a cut), the tree fetch
returns no :block, and <sorted-block-and-children returned (cons nil nil).
blocks-for-clipboard turned each nil into {:db/id nil}, the clipboard
payload gained one untitled, uuid-less block per deleted selection, and a
later paste gave all of them the same minted uuid (insert-blocks-aux keys
its uuid map by the source uuid, which was nil for each).
<sorted-block-and-children now returns nil when the root is gone, so a
block deleted mid-copy is left out of the structured clipboard; when every
selected block is gone the clipboard keeps only the text.
Test: editor-async-test copied-selection-skips-blocks-deleted-before-their-tree-loads
deletes the selection between the two fetches; before the fix the
clipboard held three {:db/id nil} blocks.
A page's linked/unlinked references section creates its view block when
it first renders. When an undo removed the page while the section was
still mounted, the view was inserted with :logseq.property/view-for
naming the gone node, and the worker refused the whole write ("DB write
failed with invalid data", view-for "should be a node with a title").
The client checks the parent before creating the view, but it reads its
own copy of the db, which can still hold a node the worker has removed. A
local key fuzzer still hit it about twice per 12 runs.
apply-insert-blocks-op! now drops blocks whose
:logseq.property/view-for has no datoms, and inserts nothing when no
block is left. A view for a node that is gone is never valid, so only a
write that validation would refuse is dropped.
insert-blocks-op-skips-a-view-for-a-node-that-is-gone inserts a view for a
page that was just retracted (not inserted; before the change the write
failed with "DB write failed with invalid data") and one for a page that
exists (inserted).
…ed, not failed The editor sends its writes to the db worker and the worker applies them in order. A property write (Ctrl+Enter on a selection, typing "> ", "```", "1. ", a property value) can reach the worker after an undo, a delete or a cut removed its block or property. The worker refused it, "Set block property failed: block or property doesn't exist" (or "Property ... doesn't exist" for a property an undo removed), and the whole batch was lost. Client-side re-checks narrow the gap but can't close it: the client checks its own copy of the db. A local key fuzzer hit it in most runs on a build with every other fix. apply-op!'s :set-block-property and :batch-set-property now drop writes whose block or property is gone when the batch carries :skip-missing-targets? (a batch write keeps its live blocks). The app's apply-outliner-ops sets it on every call; the CLI and other callers don't, so a wrong uuid from them still fails with the same error. property-ops-skip-a-gone-block-only-when-asked writes to a deleted block without the option (fails as before), with it (dropped, the block isn't recreated; before the change it failed) and in a batch with a live block (the live block gets the value).
…he worker act where they were pressed
What the user saw: after Enter, Backspace or Delete followed quickly by undo/redo or a click on another block, the outline flipped to a stale state after it had been right. Seen in e2e: Control+z right after an Enter turned the new block "c" into "zc" and the undo did not happen (the next undo undid the wrong step); a Delete at the end of "d" followed by a click on "f" joined "g" into "d" ("dg") as well as into "f".
Cause: three places act on whatever the editor holds when the worker answers, not on what it held at the keypress.
- keydown-not-matched-handler appended every one-character key to the block a pending Enter makes, Control/Meta chords included: Control+z became the text "z" and was stopped, so the undo shortcut never ran.
- undo and redo saved the editor buffer and sent the undo while an Enter or a Backspace/Delete join was still running, so the cursor restore raced the key's own editor move.
- delete-concat read the editor input and editor state again after its block lookups: a click in between made it join the next block of the newly clicked row into the block Delete was pressed in.
Change: the pending-Enter branch skips Control/Meta chords; undo and redo wait for <pending-block-delete and <pending-new-block before saving and sending; delete-concat takes the input and editor state the Delete handler read at the keypress.
Test: frontend.handler.editor-key-landing-test (Control+z/Meta+y during a pending Enter add no text and are not stopped; undo and redo wait for a running Enter or join; a Delete join uses the row it was pressed in after a click moves the editor). All four fail without the change and pass with it.
The undo's render delta reaches the pipeline before the undo's result reaches the history handler, so update-editing-block-title-if-changed! put the undone text into the editor first, cursor at the end, and the cursor restore that landed about 50 ms later moved the cursor over whatever the user had selected in between: Mod+a then Backspace right after Mod+z deleted one character (cursor-boundaries-word-motion-and-kill-test). While our own undo/redo is in flight the pipeline holds the editing block's new title back; the restore sets text and cursor together, and the held title is applied afterwards if the restore left another text.
The undo's render delta puts the undone text into the editor before the undo's result reaches the history handler; the cursor restore then pulled the block and called edit-block!, which loads it again, and moved the cursor over whatever the user had selected in between: Mod+a then Backspace right after Mod+z deleted one character (cursor-boundaries-word-motion-and-kill-test, which fails the same way on master under load). The undo/redo snapshots the editing block, its text and selection before the worker request. The restore edits the block only if the user did nothing there meanwhile (the editor holds the snapshot, or the undone text with the cursor at its end), checked after the pull and once more through a one-time edit guard right before edit-block! moves the editor. The edit-block! call is master's, unchanged. This replaces 7095560, whose pipeline hold-back of the editing title conflicted with logseq#13909's change to the same pipeline function.
… editor acts on the block moved to ArrowUp from b3 into b2 first saves b3 and loads b2, two worker round trips (over a second on a busy worker) while the editor is still on b3. A Delete pressed in that window ran on b3: at its end, with nothing after it, it did nothing, and then the editor landed on b2 (master's delete-end-test: "b2" instead of "b2b3" in 2 of 3 quiet runs and every loaded run here; a probe traced ArrowUp at 3198 ms, Delete at 3447 ms, the editor on b2 at 4377 ms). The cross-boundary move is tracked until it lands, as a pending Enter or Delete join already is, and Delete and Backspace wait for it, then act on the block the editor moved to. The save of the block left stays awaited, so the join reads its text.
…p/Down to reselect the moved rows After Alt+Shift+Down moves selected blocks out of their parent, the selection holds the rows drawn before the move until the move's delta is flushed and the new rows are reselected. A Shift+Down pressed in that gap read the old row, which is no longer in the page, found no neighbour and did nothing: the selection stayed on the moved block. Master's e2e move-across-parents-keeps-selection-test catches it (CI on logseq#13912, 2026-11-18; 20 of 36 runs on master under 6 parallel lanes). A second Alt+Shift+Up/Down already waits for the previous move through *move-up-down-tail. Shift+Up/Down (both bindings) and Up/Down on selected blocks now wait for it the same way (after-pending-move); with no move running they act at once. Test: frontend.handler.editor-move-select-test: with a move pending no selection key acts, and each acts once the move settles; without a move Shift+Down acts at once. Fails without the change, passes with it. move-across-parents-keeps-selection-test under 6 lanes: 0 of 36 failed with the change.
39bec4f to
34651c1
Compare
…it merges cleanly with logseq#13782 The tests this PR added to editor_test.cljs sat at the same place as the ones logseq#13782 adds there, so the two PRs conflicted and the nightly merge left one of them out. The tests are unchanged; they now live in frontend.handler.editor-fuzz-ui-test, which carries the requires and the DB fixture they need, and editor_test.cljs is back to master's.
This PR combines #13547, #13598, #13603, which change the same files, into one branch on current master so they no longer conflict with each other. Each part is unchanged except where two of them touched the same lines.
#13547: perf(editor): less work per keystroke and per delete
This brings #13210, #13213 and #13479 into 1 pull request, so they merge once. All 3 edit
src/main/frontend/handler/editor.cljs, and #13213 was already stacked on #13210. The branch is on current master. Each part keeps its own commits, unchanged, so the review can go commit by commit;refactor: drop write-only last-key-code bookkeepingis the maintainer's commit from #13210. The old pull requests are closed with a link here; their review threads stay there.Commits, in order:
enhance(editor): keep per-keystroke bookkeeping out of the app state store(enhance(editor): keep per-keystroke bookkeeping out of the app state store #13210)refactor: drop write-only last-key-code bookkeeping(enhance(editor): keep per-keystroke bookkeeping out of the app state store #13210)enhance(state): only re-evaluate subscriptions that read a changed path(enhance(state): only re-evaluate subscriptions that read a changed path #13213)refactor(state): drop the unused changed-paths option(enhance(state): only re-evaluate subscriptions that read a changed path #13213)perf(editor): delete selection without pre-read(perf(editor): delete selection without pre-read #13479)fix(worker): nil resources for deleted blocksand its two follow-ups are dropped: master's 05c3ae7 decides a required missing renderer entity fails fast (missing-renderer-resource-errors-include-the-uuid-test) and handles the deleted reaction target inblock-reactionsitself.Tests
The whole unit suite on this branch (master
68a68263bplus these 6 commits), with thedb-worker-nodetarget compiled: atTZ=Etc/GMT+122570 tests, 12816 assertions; atTZ=Pacific/Kiritimati, the date-dependent namespaces, 1521 tests, 9322 assertions: 0 failures, 0 errors.The descriptions of the parts follow, as each pull request had them.
#13210: enhance(editor): keep per-keystroke bookkeeping out of the app state store
What changes
A keystroke in the editor writes the app state store once (the block text) instead of 5 times.
Mechanism
Every keystroke wrote
:editor/content,:editor/last-input-time,:editor/last-key-code,:editor/last-saved-cursorand:ui/global-last-key-codethroughstate/set-state!. Each write makes the rfx store re-evaluate every mounted subscription, so on a page with many blocks a keystroke paid that sweep 5 times. Nothing subscribes to the 4 bookkeeping values; they are read imperatively (state/input-idle?,state/get-editor-last-pos,state/get-ui-last-key-code). They now live in plain atoms infrontend.state, reset whereclear-edit!andset-editing!reset them, with the same getters and setters.Numbers
Typing into a block on a 204 KB page of a 2,000 page graph, key press to next frame, p50 / p90 / max over 83 keys at a 60 ms cadence, Chromium 148 renderer driven over the DevTools protocol: before 44.7 / 50.7 / 66.3 ms, after 34.9 / 49.5 / 88.3 ms. Keyup handling per key dropped from 32 ms (Event Timing
keyupduration p50) to under 16 ms.Tests
The existing unit suite, compiled with
pnpm cljs:testand run with the grouping ofbb dev:run-test-namespaces(213 namespaces, 2106 tests, 8650 assertions): every test passes exceptfrontend.handler.db-based.import-test/import-from-sqlite-db-persists-import-marker-through-worker-test, whose 5 assertions fail identically on unpatched master (be800f1) whenever that namespace shares a node process with the 6 namespaces the runner groups it with, and pass when the namespace runs alone. With one node process per namespace the suite is fully green on this change. No new test: the change moves values between storage mechanisms with identical getters.Link to Devin session: https://app.devin.ai/sessions/a0806935382643ff89101cd35b49ffdb
Open in Devin Desktop: https://app.devin.ai/desktop/session/a0806935382643ff89101cd35b49ffdb?variant=devin
Requested by: @tiensonqin
#13213: enhance(state): only re-evaluate subscriptions that read a changed path
What changes
A write to the app state store re-evaluates only the subscriptions that read the changed path instead of every mounted subscription.
Mechanism
Depends on the rfx change "Recompute only the subscriptions that read a changed app-db path".
deps.ednpoints at that commit on the fork; it will be repointed to upstream rfx once that change merges.state/set-state!andstate/update-state!know which app-db path they change, andfrontend.stateregisters every state keykas a subscription[k & path]with the single signal[::state-key k]whose function is(get-in value path).frontend.rfxnow tells the store both facts:replace-state-paths!bindsstore/*changed-paths*aroundnext-state!, andsub-keymaps[k & path]to[k (first path)]and[::state-key k]to[k nil](any other subscription is left to its declared signals). Writes without a path (swap-state!, rfx event:dbeffects) fall back to the store's two level comparison of the previous and next db.Concretely, typing rewrites
[:editor/content uuid]and only the popups subscribed to that path are re-evaluated; moving the editing cursor rewrites:editor/editing?and only the 2 blocks whose[:editor/editing? [container-id uuid]]entry changed are re-evaluated, not every mounted block.Numbers
On a 204 KB page of a 2,000 page graph, Chromium 148 renderer driven over the DevTools protocol,
requestAnimationFrameafter each key, p50 / p90 / max: moving the editing cursor between blocks with ArrowDown / ArrowUp, 44.4 / 50.2 / 76.5 ms before the full set of changes and 20.8 / 31.2 / 47 ms after; a click into a block painted after 160 ms (max 240) before and 48 ms (max 64) after; tasks over 50 ms during 40 block moves: 38 before, 0 after. In a CPU profile of typing before this change, the store sweep triggered by the window keydown handler cost about 15 ms per key and the:editor/contentwrite about 12 ms per key; after it,next-state!no longer appears above 1 % of the profile.Tests
The existing unit suite on the 4 branches combined, compiled with
pnpm cljs:testand run with the grouping ofbb dev:run-test-namespaces(213 namespaces, 2106 tests, 8650 assertions): every test passes exceptfrontend.handler.db-based.import-test/import-from-sqlite-db-persists-import-marker-through-worker-test, whose 5 assertions fail identically on unpatched master (be800f1) whenever that namespace shares a node process with the 6 namespaces the runner groups it with, and pass when the namespace runs alone. One wall-clock assertion infrontend.worker.search-test(sync-search-indiceof 300 blocks under 1000 ms with semantic search disabled) measured 1194 ms in one run and passed on reruns; the worker code is untouched by these branches. With one node process per namespace the suite is fully green. The store behaviour itself is tested in the rfx change.#13479: perf(editor): delete selection without pre-read
What changes
Deleting selected blocks (Backspace or Delete on a selection, and the delete step of Cut) went through
cut-selection-blocksinsrc/main/frontend/handler/editor.cljs. It read the selected blocks from the worker (db-async/<get-blocks) only to keep the top-level blocks of the selection and to skip a selection made only of recycle roots, thendelete-blocks!sent:delete-blocks. The editor moved to the block above when the worker replied (run-response-editor-callback!insrc/main/frontend/db/transact.cljs), although the reply of a delete carries no editor rows (operation-row-uuidsreturns none for:delete-blocks). A key pressed before the reply found no editor and was lost.The delete is sent without a read. The window sends the uuids of the selected rows in selection order, with the facts it reads from the DOM as before:
[:delete-blocks [uuids {:selection {:original-ids {...}}}]].:original-idsmaps a rendered linked block to its linking block (originalblockid, the same lookupblock-handler/get-top-level-blocksuses), and on mobile:delete-journals? trueis added.logseq.outliner.op/apply-ops!resolves an op with:selectionagainst the db into the ops the window used to send:outliner-core/blocks-with-level;:logseq.property/deleted-atcounts: the:block/parentof a<get-blocksrow is a ref summary without that attribute, soldb/recycled?never saw a recycled parent there;:delete-pageops.The recorded outliner ops, which undo and sync read, are the ones the window sent before (unit tests below compare them). Page nodes are still deleted as nodes (db-test#1242). Callers of
:delete-blockswithout:selectionare unchanged.The editor moves when the op is sent.
delete-blocks!marks its editor callback with:editor/edit-block-on-send?, andapply-outliner-opsschedules it when it queues the request instead of running it after the reply; the reply then only applies its delta. The target is found in the DOM as before (edit-previous-window-block-fnon the row above the first selected row). The window changes no data: the deleted rows leave when the worker's delta arrives, as before.cut-selection-blocksno longer waits for the reply, socut-blocks-and-clear-selections!clears the selection right after the send.The callback runs at the next animation frame (
on-next-frame!, which the file already has), after the key event is fully dispatched. Two other timings failed on the way:KeyboardShortcutHandlers onwindow, and the editing-only one (:editor/backspace,:editor/delete) receives the key after the one that handles the selection, so it also deleted the last character of the block above.setTimeout0 task, Chromium dispatched a key pressed 10-35 ms after the Backspace before the timer task (a renderer trace shows the delete's keydown task, a frame, the next keydowns, then the timer), and that key found no editor: Shift+ArrowUp landed in 15 of 30 tries on the desktop app.(Dropped from this branch: master now decides this differently, see the commit list. Kept here for the record.) The worker renders the resources of a deleted block as nil (a separate commit, first on the branch).
:thread-api/get-render-snapshotsfailed its whole batch when one resource named a block the worker no longer had, and the page fell to the "Something went wrong" screen. A delete op can reach the worker before a snapshot batch the renderer queued earlier, since the loader sends one batch at a time. Master has the same race in its code; I have not seen it fail there (240 runs of the steps below), and this branch sends the op sooner and keeps the page working while the delete is in flight. In 60 runs of thedeletesteps on the e2e build, with the unit suite running beside them, 2 ended on that screen after:block-display-propertiesfailed for the block just deleted ("Missing renderer resource entity").render-snapshotsnow catches the renderer's failure to find the key's owner (the key's second element, the ownerfrontend.db.subs/apply-delta-storereads), and returns a nil value watching[:entity owner], asmissing-view-dataandblock-breadcrumbalready do for their missing targets; every window consumer of these resources treats nil as not loaded. Only that failure is caught:common/entity-by-uuid!marks its missing-entity error with the uuid it looked for, and any other error, a bad argument or a lookup of another entity, fails the request as for a live block.block-display-propertieschecks its context before it looks the block up, so a bad context fails whether or not the block exists.block-comment-summary-resource-rejects-invalid-uuid-and-thread-testexpected a random uuid to fail; that case moved to the new test.When the worker refuses the delete (a built-in node; the worker broadcasts its notification as before) or fails, the rows stay and the editor stays on the block above; the error is logged as
:editor/delete-selection-failed. Before this change the editor did not move and the selection stayed. The editor is not moved back, since a key typed into it after the delete would be lost again. A selection of recycle roots, or of blocks the worker no longer has, now also leaves the editor on the block above, where before nothing happened.:ui/page-idis no longer computed for this op:apply-outliner-opsremoves it before the worker call and no code reads it.The desktop app, release compiles of the renderer, the db worker and the Electron main from 1 commit each (master
16c4ed1a0and this branch), a new graph without sync, a page of 4 blocks. Each delete selects the last block with Escape and presses Backspace, asdelete-testdoes; each key waits until no worker request has been in flight for 400 ms. Median (range), sessions in the order master, branch, branch, master, 30 deletes each:A key pressed right after the Backspace, as fast as the test driver sends it, 30 times each, 1 session per build (a second master session gave the same counts):
x: it lands in the editor of the block above in 0 of 30 on master (pressed 5.6 - 21.7 ms after the Backspace), 30 of 30 here (7.6 - 30.7 ms);Those branch sessions ran the delete change alone. The branch with both commits, 1 more session of each kind: 13.8 ms (7.5 - 51.2) to the editor, and the letter and Shift+ArrowUp landed 30 of 30 each. No branch session logged a console error.
The e2e web build (
clj-e2edefines, release compile with--debug), master16c4ed1a0against this branch, 3 runs side by side on this machine:outliner-basic-test'sdeletesteps as master has them (Shift+ArrowUp right after the Backspace, without a wait for the editor), repeated 20 times per run on a fresh page: master lost the first Shift+ArrowUp in 8 of 60 iterations (b3's editor mounted after that key), this branch in 0 of 180 (run with the whole unit suite beside it). Backspace to b3's editor mounted, median (p90, max): master 72 ms (330, 504), this branch 20 ms (76, 138). Both builds also end some iterations with no editor (master 3 of 60, this branch 7 of 180), each after the test's second Escape, the race test(e2e): wait out editor races in delete-test #13474 fixes in the test. No iteration ended on the error screen.outliner-basic-test: master 3 of 5 runs pass (failures inconsecutive-backspace-does-not-restore-deleted-blocks-test,backspace-empty-first-child-keeps-empty-parent-subtree-test,delete-end-test,enter-then-tab-on-collapsed-block-expands-it-test), this branch 4 of 4.editor-basic-test: master 0 of 2 runs pass (move-blocks-cmdk,page-ref-navigate-persists-edit-buffer-with-open-popup-test,move-blocks-mod+shift+m), this branch 2 of 2.Tests
logseq.outliner.op-test(deps/outliner/test): the worker keeps the top-level blocks in selection order and records[:delete-blocks [[a11 a b] {}]]for a selection[a11 a a1 b]; a selection of a recycle root resolves to no op, while a block under a recycle root and a recycle root beside a live block are deleted; a rendered linked block deletes its linking block and keeps the target; with:delete-journals?a journal page becomes a:delete-pageop and goes to the recycle bin. On master these 4 tests fail (8 failures).apply-outliner-ops-runs-an-edit-on-send-callback-when-the-op-is-sent-testandapply-outliner-ops-keeps-an-edit-on-send-when-the-worker-fails-testinfrontend.db.transact-test: the request is out and the editor has not moved within the task that sent it; the callback runs at the next animation frame, once, before the reply; it still runs when the worker fails, and the failure reaches the caller. On master they fail (4 failures). A check of the same kind failed against the microtask version.delete-selection-sends-the-selection-and-focuses-the-previous-block-at-sendinfrontend.handler.editor-async-testreplaces the test that asserted the editor moved only from the reply: no worker read before the op, the op carries the selected ids, the editor moves before the reply and not again after it. On master it fails (3 failures).cut-selection-blocks-uses-inner-text-property-value-testinfrontend.handler.editor-testnow checks that Cut sends the inner property-value block without a read (2 failures on master).delete-selected-child-page-unlinks-namespace-and-keeps-content,delete-selected-block-still-removes-its-children) pass through the worker path.TZ=Etc/GMT+12(2518 tests, 12547 assertions,logseq.outliner.op-testincluded) and its time-zone-dependent namespaces withTZ=Pacific/Kiritimati(1483 tests, 9100 assertions): 0 failures, 0 errors.Allow edits from maintainers.
#13598: fix(editor): scroll a moved block into view after it moves
Moving a block with Shift+Alt+Down past the bottom edge of the window leaves it below the edge: the page does not follow it. Each further press moves it further out of view, so the press looks like it did nothing. Shift+Alt+Up at the top edge follows the block.
The move scrolled the block into view before the move was applied, at the block's old place, which was still on screen, so the scroll did nothing. Up worked only because the block's old place at the top edge was already partly off screen.
The scroll now runs once the move is applied and the block is drawn in its new place.
From review, a second commit: the scroll runs only if the graph and route are still the ones the move started in (a page left during the move is not scrolled), and it scrolls the block's row in the view it was moved in, not a copy of it drawn first in an embed or the sidebar. Tests:
moved-row-is-taken-in-the-view-it-moved-in-test,move-scroll-context-is-the-graph-and-route-test.Before, on master, a 40-block journal with block 20 at the bottom edge of the window, 4 presses of Shift+Alt+Down: the block's top ends 86 px below the window's bottom edge, the page never scrolls. After: the page scrolls with every press and the block stays on screen. Held down (10 presses, 33 ms apart): before, 254 px below the edge; after, on screen. Up at the top edge, moves in the middle of the page, and blocks with children move as before.
#13603: fix(editor): Alt+Shift+Up/Down waits for a running Enter or Backspace/Delete join
Alt+Shift+Up/Down pressed right after Enter, or right after a Backspace/Delete join, moves the wrong block or nothing.
On a page with blocks a, b, c, d, e:
Enter and the joins run in steps that each wait on the db worker; only the last step moves the editor to the new or joined block. A move pressed before that takes the block that was split or deleted.
The pending Enter now carries a promise that settles when it has moved the editor (or failed), a running join is recorded the same way, and
move-up-downwaits for both before it takes the edited block. With neither running, the move starts as before.Measured with real key events, the move key a fixed time after Backspace or Enter: before, 24 of 24 presses missed 20 ms after Backspace and 16 of 16 moved the wrong block 20 ms after Enter (2 of 24 and 3 of 16 at 40 ms). After, 0 at 0, 20 and 40 ms.
frontend.handler.editor-test,frontend.handler.editor-async-testandfrontend.handler.editor-lifecycle-testpass.A second commit closes 2 gaps found in review:
New tests in
frontend.handler.editor-test:enter-ends-when-its-insert-succeeds-without-the-editor-callback-testandbackspace-join-is-pending-during-its-sibling-lookup-test(both fail without the second commit).frontend.handler.editor-test,frontend.modules.outliner.core-test,frontend.handler.paste-test,frontend.components.editor-testandfrontend.handler.block-testpass.Replaces #13600 and #13601.
fix(editor): keys typed while Enter's insert is in flight keep their spaces
Not from an earlier PR: found through
consecutive-enter-keeps-text-and-cursor-on-the-new-block, which fails at random in CI (Test editoron this PR, #13781 and others) with a space lost:"rapidenter alpha".Keys typed between Enter and the new block's insert landing are buffered as the pending block's
typed-text; when the insert lands,inserted-block-edit-fnhands them toedit-block!as:custom-contentwith the cursor after them.state/set-editing!trimmed every content and wrote it into the textarea, so a buffer ending in a space ("rapid ") lost it under the cursor and the next keys joined the word.set-editing!now takes:keep-whitespace?, which the threeedit-block!calls ofinserted-block-edit-fnpass; every other caller trims as before.Proof, the test repeated in several browsers side by side on one machine (to load it like a slow CI runner): master's own CI build (
static-buildof run 40164671034) lost the space in 5 of 67 runs; builds with this commit (on master alone, and on this branch) in 0 of 61.fix(editor): an Enter pressed while the previous Enter's insert runs is queued, not dropped (reverted)
Reverted on 2026-11-16 (e0ee020); on the 2026-11-18 rebase onto master ec5b9f9 the commit and its revert were both dropped from the branch, which leaves the same code. Master's #14024 (logseq/db-test#1535, tiensonqin) pins the opposite in
enter-while-insert-is-pending-is-dropped-test: a second Enter during a pending insert starts no insert and is not queued, so Backspace cannot undo it. Master's behaviour wins. On the rebase onto master 4d7e4e0 this branch also takes master's landing check for Backspace during a pending Enter (:source-uuid,pending-new-block-delete-on-backspace?,apply-pending-new-block-backspace). Typing a word, Enter, a word fast while the first insert is slow still gives one block of both words; that is master's choice now.The original section:
Also found through
consecutive-enter-keeps-text-and-cursor-on-the-new-block, which under load also gave"rapid enter alpharapid enter beta":keydown-new-block-handlerdropped an Enter that came while an insert was pending (itspreventDefaultbranch), while typed keys and a Tab were kept, so typing a word, Enter, a word fast made one block of both when the first insert was slow.The pending insert now records where in the typed text the Enter fell (
:enter-at). When the insert lands, the new block gets the keys typed before it, andreplay-queued-enter!presses the Enter once the editor is on that block (it waits for the block's editor box to set the editor args, up to 60 frames), carrying the keys typed after it, and a Tab queued after it, into the next insert's pending state (*pending-new-block-carry, read bystart-pending-new-block!). Backspace right after a queued Enter takes the Enter back; a second queued Enter is dropped as before; with doc-mode's Enter-for-new-line the Enter is a typed newline. If the replayed Enter makes no block (an empty block outdents instead), the carried keys stay in the editor.New tests in
frontend.handler.editor-test:enter-during-a-pending-insert-is-queued-where-it-fell-test,pending-insert-landing-replays-the-queued-enter-test,a-replayed-enter-starts-its-insert-with-what-it-carries-test. CI's whole unit suite (pnpm cljs:run-test) passes;consecutive-enter-keeps-text-and-cursor-on-the-new-blockpassed 16 of 16 runs under load on this branch's build.fix(editor): ArrowDown out of a refused title edit saves it once
Found by a local key fuzzer (random editor keys on fresh pages). Editing a page title to a name another page has (e.g. "page 2" to "page" while "page" exists) and pressing ArrowDown within 450 ms of the last keystroke sent the refused save twice: two
Another page named "page" already exists.warnings, twoDuplicate pageerrors in the worker log.Every keystroke schedules a 450 ms auto-save (
edit-box-on-change!).move-cross-boundary-up-downsaves the text withsave-block!directly, which, unlikesave-current-block!, leaves that timer pending; when the save is refused the editor stays in the title, the timer fires and saves the same text again. When the save is accepted the timer's save finds nothing changed, so accepted title edits and ordinary block edits sent one save already (counted in a web build: 1, 1, and 2 for the refused edit).move-cross-boundary-up-downnow clears the pending auto-save right before its own save, which replaces it.New test
arrow-down-out-of-a-refused-title-saves-it-once-test(infrontend.handler.editor-test): it schedules the auto-save throughedit-box-on-change!, refuses the ArrowDown save and checks one save goes out; before the change the auto-save went out too.fix(outliner): collapse/expand skips a block that is gone
Found by the key fuzzer: Ctrl+Up/Down on a block that isn't in the db (right after Enter while the new block's insert hasn't landed, or on a block just deleted) failed the whole transaction with
DB write failed with invalid data. The:collapse-expand-blocksop transacted the frontend's{:block/uuid :block/collapsed?}maps as they came, so a missing uuid became a bare entity with those two attributes, which fails validation as a block without title, parent, order and page. The op now drops the maps whose block doesn't exist, as the move and indent/outdent ops next to it already do.New test
collapse-expand-blocks-op-skips-missing-blocks(deps/outliner/test/logseq/outliner/op_test.cljs, run by the outliner library'spnpm test): a missing block collapsed together with an existing one; fails on master withDB write failed with invalid data, passes with the change.fix(editor): ArrowUp into a journal's title selects it, not edits it
Found by the key fuzzer: ArrowUp from a journal page's first block opened the journal's title in the editor, though a click on it doesn't (it is date-derived and read-only) and Backspace into it selects it (
previous-block-edit); edits there were refused by the worker (journal page protected attr updated, it had turned "Oct 25th, 2026" into "Oct 2th, 2026") while the editor stayed in the title.move-cross-boundary-up-downnow selects a journal's title instead of editing it; other page titles are edited as before, and the page lookup only runs when the target is a page title.New test
arrow-up-into-a-journal-title-selects-it-test: ArrowUp into a journal's title selects it, into an ordinary page's title edits it; fails on master (the journal's title is edited). CI's whole unit suite passes.fix(copy): skip blocks deleted before their tree is read
What happened. A key fuzzer's paste was refused by the worker with
DB write failed with invalid data. The pasted payload was one block repeated three times, every copy with a nil:block/titleand the same uuid, so Datascript merged the three inserts into one entity with no title, validation rejected the transaction, and the whole paste was lost. The clipboard came from an earlier round that pressed Control+c over a selection and then, with no wait, Backspace or Control+x on the same selection.Cause. Copying is asynchronous.
<get-all-blocks-by-ids(src/main/frontend/handler/editor.cljs) first loads the selected blocks with<get-blocks, then fetches each block's tree with<get-block-with-children. When the blocks are deleted between those two reads, the worker returns a result with no:block, and<sorted-block-and-childrenreturned(cons nil nil).blocks-for-clipboardturned each nil into{:db/id nil},copy-to-clipboard-without-id-property!added:block/title nil, and the structured clipboard held one untitled, uuid-less block per deleted selected block. On paste,insert-blocks-auxkeys its uuid map by the source uuid; with every source uuid nil, all the blocks got the same freshly minted uuid (which is why the logged uuid sat right after the target's), and the merged entity had no title.Fix.
<sorted-block-and-childrenreturns nil when the block's root no longer exists, so a block deleted mid-copy is left out of the structured clipboard. When every selected block is gone, the clipboard keeps only the text that was already written, and a paste falls back to a text paste.Tests.
frontend.handler.editor-async-test/copied-selection-skips-blocks-deleted-before-their-tree-loadsselects three blocks and deletes them between the selection read and the tree read. Before the fix the clipboard held[{:db/id nil} {:db/id nil} {:db/id nil}]; after it, the clipboard is empty.editor-async-test,editor-test,paste-test,common-test, the whole unit suite and lint pass.fix(outliner): an insert drops a view block whose node is gone
Found by the key fuzzer: a page's linked/unlinked references section creates its view block when it first renders; when an undo removed the page while the section was still mounted, the view was inserted with
:logseq.property/view-fornaming the gone node and the worker refused the whole write (DB write failed with invalid data, view-for "should be a node with a title"). The client can check the parent first (#13852), but it reads its own copy of the db, which can still hold a node the worker has removed; the fuzzer still hit it about twice per 12 runs.apply-insert-blocks-op!now drops blocks whose:logseq.property/view-forhas no datoms (and inserts nothing when none is left). A view for a node that is gone is never valid, so only a write that validation would refuse is dropped.New test
insert-blocks-op-skips-a-view-for-a-node-that-is-gone(deps/outliner/test/logseq/outliner/op_test.cljs, the outliner library'spnpm test): a view for a page that was just retracted is not inserted (fails on master withDB write failed with invalid data), one for a page that exists is inserted.The worker drops the editor's writes to things that are gone
The editor decides a write from its own copy of the db and sends it to the db worker, which applies writes in order. An undo, a delete or a cut that reaches the worker first can remove the block, page or property the write targets, and the worker then refused the whole batch (
DB write failed with invalid data,Set block property failed: block or property doesn't exist). Client-side re-checks narrow the gap but can't close it, because the client checks its own copy. A local key fuzzer (random editor keys, undo/redo chains, selections, popups, sent with no wait) hit these in most runs. Three commits below close them in the worker, each covered by a test that fails on master:collapse-expand-blocks-op-skips-missing-blocks);insert-blocks-op-skips-a-view-for-a-node-that-is-gone);property-ops-skip-a-gone-block-only-when-asked). This one only applies to batches the app'sapply-outliner-opsmarks with:skip-missing-targets?; the CLI and other callers don't, so a wrong uuid from them still fails with the same error.Their sections follow.
fix(outliner): the editor's property writes to a gone block are dropped, not failed
Found by the key fuzzer, in most runs on a build with every other fix: the editor sends its writes to the db worker, which applies them in order, so a property write (Ctrl+Enter on a selection, typing
>,```,1., a property value) can reach the worker after an undo, a delete or a cut removed its block or property. The worker refused it (Set block property failed: block or property doesn't exist, orProperty ... doesn't existfor a property an undo removed) and the whole batch was lost. Client-side re-checks narrow the gap but can't close it, since the client checks its own copy of the db.apply-op!'s:set-block-propertyand:batch-set-propertynow drop writes whose block or property is gone when the batch carries:skip-missing-targets?(a batch write keeps its live blocks). The app'sapply-outliner-ops(frontend.db.transact) sets it on every call; the CLI and other callers don't, so a wrong uuid from them still fails with the same error.New test
property-ops-skip-a-gone-block-only-when-asked(deps/outliner/test/logseq/outliner/op_test.cljs): a write to a deleted block without the option fails as before, with it is dropped without recreating the block (fails on master: the write throws), and a batch with a live block still sets the live one.fix(editor): keys pressed while an Enter or a Delete join waits for the worker act where they were pressed
What the user sees on master: after Enter, Backspace or Delete followed quickly by undo/redo or a click on another block, the outline goes to the right state and then flips to a stale one. This is the flaky
logseq.e2e.outliner-basic-test/boundary-delete-and-backspace-merge-contract-test(about 1 in 15 runs on master e7e9c97, red in CI). In the failing runs: Control+z right after an Enter turned the new block "c" into "zc" and the undo did not happen, so every later undo was one step off; a Delete at the end of "d" followed by a click on "f" joined "g" into "d" ("dg") as well as into "f".Cause: three places act on what the editor holds when the worker answers, not on what it held at the keypress. (1)
keydown-not-matched-handlerappended every one-character key to the block a pending Enter makes, Control/Meta chords included: Control+z became the text "z" and was stopped, so the undo shortcut never ran. (2) Undo and redo saved the editor buffer and sent the undo while an Enter or a Backspace/Delete join was still running, so the cursor restore raced the key's own editor move. (3)delete-concatread the editor input and editor state again after its block lookups: a click in between made it join the next block of the clicked row into the block Delete was pressed in.Change: the pending-Enter branch skips Control/Meta chords;
undo!/redo!wait for<pending-block-deleteand<pending-new-block(the same waits Alt+Shift+Up/Down uses) before saving and sending;delete-concattakes the input and editor state thatkeydown-delete-handlerread at the keypress.Tests: new namespace
frontend.handler.editor-key-landing-test: Control+z/Meta+y during a pending Enter add no text and are not stopped (a plain key is still kept); undo waits for a pending Enter and redo for a running join before saving and sending; a Delete join uses the row it was pressed in after a click moves the editor. All four fail without the change (12 failed assertions) and pass with it.editor-test,editor-async-test,history-test,exit-editing-race-test,editor-lifecycle-testpass. The e2e test ran 32 times on this branch with 0 failures (and 30 times on the commit before the rebase, also 0).A selection or text made while an undo runs is not overridden by its cursor restore
What the user sees. Right after Mod+z, Mod+a then Backspace deletes one character instead of the whole block: the selection collapses to the end of the text. CI caught it as
cursor-boundaries-word-motion-and-kill-testfailing on this PR; it fails the same way on master (under 8 parallel lanes, 2 of 40 runs on master).Cause. The undo's render delta reaches the pipeline before the undo's result reaches the history handler.
update-editing-block-title-if-changed!puts the undone text into the editor at once, cursor at the end; the cursor restore then pulls the block from the worker and callsedit-block!, about 50 ms later under load, which moved the cursor again, over the selection made in between. A browser trace of a failing run showsset-edit-content!from the pipeline, then Mod+a (0:17), thenset-editing!fromedit-loaded-block!withsetSelectionRange(17,17).Change. The undo/redo takes a snapshot of the editing block, its text and selection before the worker request. The cursor restore edits the block only if the user did nothing there meanwhile: the editor still holds the snapshot, or shows the undone text with the cursor at its end (what the render delta does). It checks after pulling the block, and once more right before the editor moves:
edit-block!loads the block again, so the restore sets a one-time edit guard for that block (:editor/edit-guard) thatedit-loaded-block!consults. Theedit-block!call itself is master's, unchanged. A selection or text the user made while the undo was in flight stays, as keys pressed during a pending Enter or Delete join act where they were pressed.Test.
frontend.handler.history-restore-test: the restore runs when the user did nothing, with and without the render delta's text; it keeps a selection and typed text made while the undo ran, and a selection made whileedit-block!loads the block; the edit guard is used once and only for its block; with the guard disabled the load-time selection test and the guard test fail. The e2e test above under 8 parallel lanes: 0 of 96 failed with the change, 2 of 40 on master. Master'shistory-testpasses with itsedit-block!call unchanged.Delete or Backspace pressed while ArrowUp/Down moves the editor acts on the block moved to
What the user sees. In a page with b1, b2, b3, editing b3: ArrowUp, then Delete right away. Expected b2 and b3 joined ("b2b3"); on a busy app nothing happens, and the editor then shows up on b2. Master's
delete-end-test(outliner-rtc e2e) fails this way: 2 of 3 quiet runs and every loaded run here, on master 4d7e4e0 and on a0f4399 before #14024; it turned #13882 red in CI.Cause.
move-cross-boundary-up-downsaves the block it leaves andedit-block!loads the block it enters before the editor moves: two worker round trips, over a second on a busy worker. A probe of the textarea and keys traced ArrowUp at 3198 ms, Delete at 3447 ms, the editor on b2 at 4377 ms. The Delete ran on b3, at the end of the last block, and did nothing.Change. The move is tracked until it lands (
track-editor-move!), like a pending Enter or Delete join.editor-deleteandeditor-backspacewait for it (after-pending-editor-move) and then act on the block the editor moved to. The save of the block left stays awaited, so a join reads its text.Test.
frontend.handler.editor-key-landing-test: Delete and Backspace pressed during a pending move run only after it lands; without a pending move Delete runs at once. The e2edelete-end-teston this branch: 0 of 8 quiet runs and 0 of 40 loaded runs fail with the change, 4 of 8 quiet runs without it.Shift+Up/Down right after Alt+Shift+Up/Down acts on the moved block
After Alt+Shift+Down moves selected blocks out of their parent, the selection holds the rows drawn before the move until the new rows are reselected. A Shift+Down pressed in that gap read the old row, which is no longer in the page, found no neighbour and did nothing. Master's e2e
move-across-parents-keeps-selection-testcaught it in CI on #13912 (2026-11-18), and it failed 20 of 36 runs on master under 6 parallel lanes.A second Alt+Shift+Up/Down already waits for the previous move through
*move-up-down-tail. Shift+Up/Down (both bindings) and Up/Down on selected blocks now wait for it the same way (after-pending-move). With no move running, they act at once.New test
frontend.handler.editor-move-select-test: with a move pending, no selection key acts, and each acts once the move settles; with no move, Shift+Down acts at once. It fails without the change (1 failure) and passes with it.move-across-parents-keeps-selection-testunder 6 parallel lanes: 20 of 36 failed on master 4f754fc, 0 of 36 with this change. The editor and history unit namespaces pass.