Skip to content

fix(page): creating a page does not open a namespace child, tag or property of that name - #13625

Merged
tiensonqin merged 2 commits into
logseq:masterfrom
yuxi-liu-wired:fix/create-page-not-child-or-tag
Oct 19, 2026
Merged

tiensonqin merged 2 commits into
logseq:masterfrom
yuxi-liu-wired:fix/create-page-not-child-or-tag

Conversation

@yuxi-liu-wired

Copy link
Copy Markdown
Contributor

Part of logseq/db-test#1345 (the page side; creating a tag whose name a namespaced tag has is not covered).

Create "Foo/Bar" (the Library holds Foo, with Bar under it), then type [[Bar in a block and pick "New page Bar". No page is created and the link goes to Foo/Bar's Bar. In the other order both pages exist, as db-test#429 asked for. The same lookup opens a tag or a property: after the tag "#Foo", creating the page "foo" returns the tag.

<create! in src/main/frontend/handler/common/page.cljs pulls [:block/name ...] first and returns what it finds instead of creating. That lookup resolves to the oldest page of that name of any kind anywhere (ldb/get-page), a namespace child, a tag or a property included. The worker's own create, outliner-page/create, looks only for an ordinary page and creates a new one when the page it finds has a parent.

<create! now reuses the found page only when it is what the worker would reuse: a journal, or an ordinary page (tagged Page, not a tag or a property) with no parent or the Library as parent. Otherwise the create goes to the worker, which creates the page. :logseq.property/built-in? is added to the pulled fields so the Library is told by the same test as logseq.db.frontend.db uses.

New test create-page-does-not-open-a-namespace-child-or-a-tag-test in src/test/frontend/handler/common/page_test.cljs, against a real graph: "Bar" with "Foo2/Bar" there gives a new top-level Bar, "foo" with a tag "Foo" there gives a new page, and creating "Bar" again opens that Bar. On master the first 2 open the child and the tag; with the change it passes. create-existing-page-uses-worker-page-lookup-test's page now carries its Page tag and the new selector field. frontend.handler.common.page-test, frontend.handler.page-test, frontend.handler.db-based.page-test, frontend.components.editor-test, frontend.handler.editor-test and frontend.components.cmdk-test pass.

yuxi-liu-wired and others added 2 commits October 19, 2026 17:59
…operty of that name

<create!'s name lookup returns the oldest page of that name of any kind
anywhere, and it returned that page instead of creating one: "Bar" with
"Foo/Bar" opened Foo/Bar's Bar, "foo" with a tag "Foo" opened the tag
(db-test logseq#1345). It now reuses only a journal or an ordinary top-level
page, as the worker's create does, and creates otherwise.
@tiensonqin
tiensonqin force-pushed the fix/create-page-not-child-or-tag branch from 8171ae3 to fe7dcf9 Compare October 19, 2026 09:59
@tiensonqin
tiensonqin merged commit 0eb43da into logseq:master Oct 19, 2026
@yuxi-liu-wired
yuxi-liu-wired deleted the fix/create-page-not-child-or-tag branch October 21, 2026 18:01
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.

3 participants