-
Notifications
You must be signed in to change notification settings - Fork 2
Description
Bug: add_tag_property argument type documented incorrectly
File: references/core-apis.md — Tag Property Management section
What the docs currently say
await parentLogseq.api.add_tag_property(tagUuid, 'propertyName')The second argument is shown as a display name string ('propertyName').
What it actually requires
Both arguments require a BlockIdentity (UUID string), not display names. Passing a property name string silently fails — the property-to-class association is not made, and no error is thrown.
Confirmed behavior (production use)
We verified this while building a manifest-driven installer for a Logseq plugin. The working call is:
await parentLogseq.api.add_tag_property(tagUuid, propertyUuid)Where:
tagUuid— UUID fromcreateTag()return value orgetTag().uuidpropertyUuid— must be resolved via DataScript afterupsertProperty(), sinceupsertPropertydoes not return a UUID:
const results = await logseq.DB.datascriptQuery(`
[:find ?uuid
:where
[?e :block/title "myPropertyName"]
[?e :block/tags ?t]
[?t :db/ident :logseq.class/Property]
[?e :block/uuid ?uuid]]
`) as [string][] | null
const propertyUuid = results?.[0]?.[0]The same UUID requirement applies to the tag argument — a display name string does not work there either.
Suggested correction
Update the example in core-apis.md to use propertyUuid instead of 'propertyName', and add a note explaining the DataScript resolution step.
Thanks for the skill — it was genuinely useful. This was the one place where the gap between the docs and the actual API bit us.