Skip to content

fix(export): a view export keeps a row whose parent is also a row - #13681

Closed
yuxi-liu-wired wants to merge 1 commit into
logseq:masterfrom
yuxi-liu-wired:fix/view-export-child-row
Closed

yuxi-liu-wired wants to merge 1 commit into
logseq:masterfrom
yuxi-liu-wired:fix/view-export-child-row

Conversation

@yuxi-liu-wired

Copy link
Copy Markdown
Contributor

Exporting the rows of a table or list view (export type :view-nodes) drops any row whose parent block is also a row. Example: a view lists "parent" and its child block "child"; the export contains only "parent", so "child" is lost on import.

Cause: build-blocks-export is called with :include-children? false for view exports, so it builds no parent-to-children map, but it still treats every block whose parent is among the exported blocks as a non-root. Such a block is then neither nested under its parent nor exported as a root.

Fix: with :include-children? false every given block is a root, so each row is exported once, flat, as view exports intend. Selected-node exports (:include-children? true) are unchanged.

Test: import-view-blocks-with-child-row in logseq.db.sqlite.export-test exports a parent and its child as view rows, checks both are in the export, imports it, validates the db and finds the child. On master it fails twice (the child is missing from the export and from the import); with the fix logseq.db.sqlite.export-test passes (45 tests, 191 assertions).

Found by mutation testing: changing :include-children? false to true in build-view-nodes-export made no existing test fail, and the changed version exported the child.

yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 12, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 13, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 16, 2026
@yuxi-liu-wired
yuxi-liu-wired force-pushed the fix/view-export-child-row branch from bb81230 to 317b15f Compare October 16, 2026 18:35
@yuxi-liu-wired

Copy link
Copy Markdown
Contributor Author

Combined with the other PRs that change the same files into #13785.

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.

1 participant