logseq / logseq/db-test

`name` option in `logseq.Editor.upsertProperty` not working

Open
#987 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
No language data
Stars
28
Forks
2
PR merge metrics
No merged PRs in 30d

Description

### Search first

- [x] I searched and no similar issues were found

### What Happened?

I wrote a plugin and create some properties via `logseq.Editor.upsertProperty` method:

```js
const properties = {
key: { schema: { type: 'default' }, opts: { name: "Jira Key" } },
url: { schema: { type: 'url' }, opts: { name: "Jira URL" } },
type: { schema: { type: 'default' }, opts: { name: "Jira Issue Type" } },
[...]
}

for (const [key, meta] of Object.entries(properties)) {
await logseq.Editor.upsertProperty(key, meta.schema, meta.opts)
}
```

The properties are created, but the name is ignored and the key is used as name.

The not working feature is described here: https://github.com/logseq/logseq/blob/master/libs/guides/db_properties_references.md#upsertpropertyname-schema-opts

### Reproduce the Bug

1. create a simple plugin
2. call: `await logseq.Editor.upsertProperty("my_test", { schema: { type: 'default' }, [meta.opts](opts: { name: "My Test" }))`
3. check created property

### Expected Behavior

Created property should use the name as display name.

### Screenshots

_No response_

### Files

_No response_

### Browser, Desktop or Mobile Platform Information

_No response_

### 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!)

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the documented upsertProperty(name, schema, opts) reference and trace the logseq.Editor.upsertProperty implementation. Reproduce the call using opts.name, then verify that the created property uses the supplied value as its display name rather than the key.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
api, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.