Thanks to visit codestin.com
Credit goes to github.com

Skip to content

fix: keep collapsed subtree after bullet zoom-back - #13196

Open
tiensonqin wants to merge 2 commits into
masterfrom
logseq/fix-collapsed-zoom-back-f48f
Open

fix: keep collapsed subtree after bullet zoom-back#13196
tiensonqin wants to merge 2 commits into
masterfrom
logseq/fix-collapsed-zoom-back-f48f

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1169 (transferred from logseq/logseq#13195).

Problem

Clicking the bullet of a collapsed subtree zooms into that block. Pressing Back then left the subtree expanded in the parent view, even though DB :block/collapsed? was still true.

Cause

The zoom/root load path calls expand-block! with skip-db-collpsing? so children can load without persisting an expand. That call omitted the zoom container-id, so :ui/collapsed-blocks was written false onto the current editor/parent container. Navigate-back cleanup only cleared the zoom container. Rendering prefers temp UI collapse over DB collapse, so the parent subtree appeared open.

Fix

  • Pass the zoom container-id from loaded-block-container-inner's display-only expand.
  • When skip-db-collpsing? is set, write UI collapse only to that explicit container. Do not fall back to the current editor container.

Tests

  • Unit: frontend.handler.editor-async-test/expand-block-skip-db-keeps-parent-container-collapse (9 assertions).
  • E2E: logseq.e2e.editor-basic-test/collapsed-subtree-stays-collapsed-after-bullet-zoom-back-test (collapse, bullet zoom, back, child stays hidden).

Collapsed parent before bullet zoom
Zoomed into the collapsed block
Parent subtree still collapsed after back

To show artifacts inline, enable in settings.

Open in Web Open in Cursor 

Display-only expand on zoom-in wrote :ui/collapsed-blocks onto the parent editor container. Scope that write to the zoom container so navigate-back still shows the DB collapsed state.

Co-authored-by: Tienson Qin <[email protected]>
Copilot AI lite review requested due to automatic review settings September 9, 2026 16:25

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

The behavioral change is localized and is backed by both unit and E2E coverage targeting the reported regression path.

Pull request overview

Fixes a UI-state leak where a display-only “expand” during bullet zoom-in incorrectly wrote :ui/collapsed-blocks to the parent/editor container, causing a previously-collapsed subtree to appear expanded after navigating back.

Changes:

  • Scope display-only expand-block! UI updates to an explicit :container-id and avoid falling back to the current editor container when :skip-db-collpsing? is set.
  • Pass the zoom container id through the zoom/root load path (loaded-block-container-inner) so the temporary UI collapse state is written to the zoom container only.
  • Add both a CLJS unit test and a Clojure E2E test to cover the regression (zoom-in + back keeps subtree collapsed).
File summaries
File Description
src/main/frontend/handler/editor.cljs Prevents display-only expands from writing UI collapse state into the current editor/parent container.
src/main/frontend/components/block.cljs Ensures zoom/root display-only expands pass the correct container-id into expand-block!.
src/test/frontend/handler/editor_async_test.cljs Adds a unit test verifying :skip-db-collpsing? expands don’t mark the parent container as open.
clj-e2e/test/logseq/e2e/editor_basic_test.clj Adds an E2E regression test for “bullet zoom-in then back” preserving collapsed state.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 0
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Add clojure.test checks so the e2e covers zoom route and parent collapse after back.

Co-authored-by: Tienson Qin <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Regression: clicking on the bullet to open the subtree leaves it open when going back

3 participants