mirror of
https://github.com/logseq/logseq.git
synced 2026-05-16 08:52:20 +00:00
Make `:ref/default-open-blocks-level 0` collapse references by default
in the DB version, matching the previous file-graph behavior. The
section fold is scoped to the page-bottom "Linked References" panel
only — the inline "Open block references" popup rendered next to
blocks always shows its references uncollapsed.
1. Collapse the "Linked References" section when the configured level
is 0, gated on a new `:linked-refs-section?` config flag set only
by the page-bottom call site in page.cljs. The inline popup at
block.cljs:3366 passes `{}` and is unaffected.
2. Propagate `:block.temp/has-children?` on the top-level fetched
block in `get-block-and-children`. The list-view loads linked-
reference blocks with `:children? false`, so `(:block/_parent ...)`
is always nil in the client DB and the collapse check in
`block-default-collapsed?` could never fire. Use a lightweight
`d/datoms :avet :block/parent` scan that stops at the first match,
rather than the reverse-ref `(:block/_parent block)` which
materializes the full child set. Includes a regression test.
3. Fall back to `:block.temp/has-children?` when computing `has-child?`
in `block-container-inner-aux`. This renders the collapse arrow for
blocks whose children exist in the worker DB but haven't been
lazily loaded into the client DB yet (e.g. linked-reference blocks).
Clicking the arrow calls `expand-block!` which loads them.
The `:ref/default-open-blocks-level 0 → (int? ...)` state.cljs fix
from PR #12228 is already present on this branch.