You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Moving a nested block and the block after its parent can reverse them #1297
On a page with blocks a, b (children b1, b2), c, add a child block under a.
Ctrl+click b2, then Ctrl+click c.
Move the selection into a block on another page.
Undo twice, then redo twice.
Expected
The target holds b2, c.
Actual
The target holds c, b2.
Cause
get-top-level-blocks in deps/outliner/src/logseq/outliner/core.cljs decides that the selection is in reverse order by comparing the :block/order values of the first 2 selected blocks, even when they have different parents, where the 2 values are unrelated. consecutive-block? treats b2 (the last child of b) and c as consecutive, so move-blocks skips the page-order sort. In the steps above, b2 has order "b9R" and c has "b9S"; undoing the move gives c the new order "b9Q", so the redo compares "b9R" with "b9Q" and moves c first. A first move reverses the 2 blocks in the same way whenever their order values compare like that.
Found with a property-based test of random outliner operation sequences with undo and redo.
Fixed by logseq/logseq#13783, which replaces #13605 (closed). When the first two selected blocks have different parents, the selection is now put in page order, so a last child and the block after its parent are no longer reversed on redo. test-move-last-child-and-next-block-keeps-page-order pins it; it fails on master (the target holds 5, 4).
Activity
yuxi-liu-wired commentedon Oct 6, 2026
Fix: logseq/logseq#13605.
yuxi-liu-wired commentedon Oct 27, 2026
Fixed by logseq/logseq#13783, which replaces #13605 (closed). When the first two selected blocks have different parents, the selection is now put in page order, so a last child and the block after its parent are no longer reversed on redo.
test-move-last-child-and-next-block-keeps-page-orderpins it; it fails on master (the target holds 5, 4).