fix: keep collapsed subtree after bullet zoom-back - #13196
Open
tiensonqin wants to merge 2 commits into
Open
Conversation
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]>
Contributor
There was a problem hiding this comment.
🟢 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-idand 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]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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!withskip-db-collpsing?so children can load without persisting an expand. That call omitted the zoomcontainer-id, so:ui/collapsed-blockswas writtenfalseonto 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
container-idfromloaded-block-container-inner's display-only expand.skip-db-collpsing?is set, write UI collapse only to that explicit container. Do not fall back to the current editor container.Tests
frontend.handler.editor-async-test/expand-block-skip-db-keeps-parent-container-collapse(9 assertions).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.