Skip to content

fix(page): a namespace root and a page with no parent share one name space - #13620

Closed
yuxi-liu-wired wants to merge 1 commit into
logseq:masterfrom
yuxi-liu-wired:fix/rename-top-level-scope
Closed

yuxi-liu-wired wants to merge 1 commit into
logseq:masterfrom
yuxi-liu-wired:fix/rename-top-level-scope

Conversation

@yuxi-liu-wired

Copy link
Copy Markdown
Contributor

Part of logseq/db-test#1346 (its second case; the first, a rename there and back being refused, no longer happens on master since #13516).

Create the page "Baz", then "Foo/Bar" (the Library now holds "Foo"). On the page "Foo", change the title to "Baz": it is accepted, and the graph has 2 top-level pages named "Baz", one of them in the Library. Renaming "Baz" to "Foo" is accepted the same way. Renaming any other page with no parent to "Baz" is refused, and Cmd+K on "Baz" opens the existing page.

validate-unique-for-page in deps/outliner/src/logseq/outliner/validate.cljs scopes the name check by the raw parent: a page with no parent is compared with other pages with no parent, a page with a parent only with its siblings. Top-level pages come in 2 kinds: a page created by name has no parent, a namespace root has the Library as its parent. So a namespace root and a page with no parent never meet in the check.

Both kinds now count as top-level: a page whose parent is the Library is compared with pages with no parent and pages under the Library, and the other way around. Pages inside a namespace keep being compared with their siblings only, so a top-level page may still share a name with a namespace child ("Baz" and "Foo/Baz").

New test rename-is-checked-among-top-level-pages in deps/outliner/test/logseq/outliner/page_test.cljs: a namespace root renamed to a top-level page's name and a top-level page renamed to a namespace root's name are refused (both accepted on master); a top-level page renamed to a namespace child's name and back, and siblings in a namespace, behave as before. The outliner tests in deps/outliner (158 tests) and frontend.handler.db-based.page-test, frontend.modules.outliner.pipeline-test, frontend.worker.undo-redo-test, frontend.worker.outliner-undo-property-test, frontend.worker.db-sync-test, frontend.worker.db-sync-sim-test (with its ^:long tests), frontend.worker.db-listener-test, logseq.api.editor-test pass.

yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 6, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 8, 2026
yuxi-liu-wired added a commit to yuxi-liu-wired/logseq that referenced this pull request Oct 11, 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
…space

A page created by name has no parent, a namespace root has the Library
as parent; the uniqueness check compared by raw parent, so renaming the
root "Foo" to an existing "Baz" gave 2 top-level pages named Baz
(db-test logseq#1346). Pages with no parent or the Library as parent are now
checked against each other.
@yuxi-liu-wired

Copy link
Copy Markdown
Contributor Author

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

@yuxi-liu-wired
yuxi-liu-wired deleted the fix/rename-top-level-scope branch October 21, 2026 18:02
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