Repository navigation
Description
Search first
- I searched and no similar issues were found
What Happened?
When you type #existing-page in a block, the autocomplete offers a "convert <page> to tag" entry. Choosing it does convert the page to a tag, but the text inserted into the block is the class uuid wrapped in page-ref brackets (#[[6ab39306-6831-432a-b488-641794461240]]) instead of a tag reference. The resulting text does not render as a tag, and the block is not tagged.
Expected: the page becomes a tag and the block is tagged with it, showing #@test rendered as a normal tag.
This looks like a regression from fe65e36f13 ("refactor: remove ui db", 2026-07-08), which removed the post-conversion entity re-read — see "Root cause" below.
Reproduce the Bug
- Create a page titled
test. - In some block, type
#and let the page autocomplete appear; pick the entry "converttestto tag". - Observe the inserted text.
Result: the block contains the literal text
#[[6ab39306-6831-432a-b488-641794461240]]
which does not render as a tag, and the block has no :block/tags pointing at the new class.
Expected Behavior
The inserted text should be #test (i.e. a tag reference), rendered as a tag, and the block should be tagged with the newly created tag class. Today the inserted text is an unreadable page-ref to a class uuid.
Root cause (read from source; regression identified via git history)
src/main/frontend/handler/page.cljs, tag-on-chosen-handler:
(p/let [repo (state/get-current-repo)
chosen-result (<chosen-result repo chosen-result) ; snapshot map, fetched BEFORE convert
_ (when (and (:convert-page-to-tag? chosen-result)
(entity/page? chosen-result)
(not (entity/class? chosen-result)))
(db-page-handler/convert-page-to-tag! chosen-result)) ; conversion runs here
target (when (and (:db/id chosen-result) (not (entity/class? chosen-result)))
(db-async/<get-alias-source-page repo (:db/id chosen-result)))
chosen-result (if (and target (not (entity/class? chosen-result)) (entity/class? target)) target chosen-result)
chosen (:block/title chosen-result)
class? (or (string/includes? chosen (str (t :editor/new-tag) " "))
(entity/class? chosen-result)) ; reads the STALE pre-conversion snapshot
...
(editor-handler/insert-command! id
(if (and class? (not inline-tag?)) "" (str "#" wrapped-tag))
...)<chosen-result (same file) resolves the selection to a plain map via :thread-api/pull, i.e. a snapshot. Because the conversion happens after that snapshot is taken and the map is never refreshed, (entity/class? chosen-result) still observes the pre-conversion tags (#{:logseq.class/Page}, no :logseq.class/Tag). class? therefore evaluates to false, so insert-command! inserts "#" + wrapped-tag instead of "", and the subsequent tag-on-chosen-handler (which is what would attach the timestamped tag) receives class? = false as well.
The previous implementation re-read the entity after converting, which the refactor removed:
;; before fe65e36f13:
(p/let [_ (when (:convert-page-to-tag? chosen-result)
(let [entity (db/entity (:db/id chosen-result))]
(when (and (ldb/page? entity) (not (ldb/class? entity)))
(db-page-handler/convert-page-to-tag! entity))))
chosen-result (if (:block/uuid chosen-result)
(db/entity [:block/uuid (:block/uuid chosen-result)]) ;; <-- re-read after convert
chosen-result)
target (first (:block/_alias chosen-result))
...)The fix is presumably to re-resolve chosen-result after convert-page-to-tag! resolves (e.g. re-pull by :block/uuid), so class? reflects the post-conversion state.
Note the conversion itself does succeed — convert-page-to-tag-tx (src/main/frontend/worker/handler/property.cljs) retracts :logseq.class/Page and adds :logseq.class/Tag on the same entity (same :block/uuid); only the editor-side text insertion is wrong.
Measured environment
- Logseq 2.0.1 desktop, DB graph, Windows (
merge-all-fixestree, HEADbb70c73d29;fe65e36f13is an ancestor, so the regression is present at HEAD). - The inserted uuid resolves to a class entity (
extends :logseq.class/Root, auto:db/ident), distinct from the pre-existing page entity. The inserted#[[<class-uuid>]]text is the defect reported here.
Files
No response
Browser, Desktop or Mobile Platform Information
Windows 11, Logseq desktop 2.0.1 (DB version), DB graph.
Additional Context
No response
Are you willing to submit a PR? If you know how to fix the bug.
- I'm willing to submit a PR (Thank you!)
Activity
e-zz commentedon Sep 23, 2026
Adding two same-subject references, both verified. Neither is claimed to be a duplicate of this bug.
#1212 (false look-alike, useful as a boundary) — establishes that
#[[<uuid>]]is the normal stored form of an inline tag in block text, and that displaying the raw UUID instead of the tag name is a name-resolution problem. That issue's fix (logseq/logseq#13307, merged, touching onlydeps/db/src/logseq/db/sqlite/build.cljs) addressed the import path: tag pages were named from the tag's:db/ident(which carries a random suffix) instead of:block/title.That is a different path from the bug reported here. This report is about the editor-insertion path: after conversion,
insert-command!writes the UUID-form text into the visible block and the block is never tagged. So the two share a surface symptom (raw UUID visible in a block) but not a cause. Worth keeping distinct, since a fix to the import path would not address this one.#598 (closed, cited for the rule, not as a duplicate) — a maintainer states the intended semantics:
That is the basis for the Expected Behavior above. An operation presented as "convert <page> to tag" should therefore end with the block tagged (a
#attachment, so the tag's properties apply), not with a[[]]reference to the class entity.Why the autocomplete path matters here
The conversion itself succeeds, and the resulting class is usable — tagging a block with it via the tag editor works correctly. Only the text the autocomplete flow inserts into the block is wrong, which is why the symptom is easy to read as "the conversion failed" when it did not.
fix: convert-page-to-tag autocomplete entry does nothing
fix: convert-page-to-tag autocomplete entry does nothing
fix: convert-page-to-tag autocomplete entry does nothing
fix: convert-page-to-tag autocomplete entry does nothing
fix: convert-page-to-tag autocomplete entry does nothing
fix: convert-page-to-tag autocomplete entry does nothing (logseq#13392)
fix: convert-page-to-tag autocomplete entry does nothing (#13392)
fix: convert-page-to-tag autocomplete entry does nothing (#13392)
fix: convert-page-to-tag autocomplete entry does nothing (#13392)