Skip to content

fix(tag): creating a tag does not return a namespaced tag of that name - #13626

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

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

Conversation

@yuxi-liu-wired

Copy link
Copy Markdown
Contributor

Part of logseq/db-test#1345 (the tag side; the page side is #13625).

Create the tag "#Foo/Baz", then the tag "#Baz": the second create returns Foo/Baz's "Baz" and no top-level tag "Baz" exists. In the other order, "#Baz" then "#Foo/Baz", both tags exist, and tags in different namespaces may share a name (db-test#466).

create in deps/outliner/src/logseq/outliner/page.cljs looks for an existing tag with ldb/page-exists? and #{:logseq.class/Tag}, which matches the exact title among all tags, whatever they extend, and returns the first. Pages are already checked for a parent before being reused.

When the title has no namespace, create of a tag now leaves out tags that extend a tag other than Root Tag, i.e. tags inside a namespace. A top-level tag with the title is still reused, and a create of a namespaced title goes through split-namespace-pages as before.

New test create-tag-does-not-return-a-namespaced-tag-of-that-name in deps/outliner/test/logseq/outliner/page_test.cljs: "Foo/Baz" then "Baz" as tags gives a new tag Baz extending Root Tag, and creating "Baz" again returns it. On master the second create returns Foo's Baz; with the change it passes. The outliner tests in deps/outliner (158 tests) and frontend.handler.common.page-test, frontend.handler.page-test, frontend.worker.handler.page-test, frontend.handler.db-based.page-test, frontend.components.cmdk-test, frontend.worker.undo-redo-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
create looked up an existing tag by exact title among all tags, so after
"#Foo/Baz", creating "#Baz" returned Foo's Baz (db-test logseq#1345). A create
without a namespace now leaves out tags extending a tag other than Root.
@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/create-tag-top-level 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