logseq / logseq/db-test

EDN Data Import duplicates content when run multiple times

Open
#959 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?

When i import a page 2 times, it's content is duplicated.

### Reproduce the Bug

0. Create new clean graph
1. Import page

```
{:pages-and-blocks
[{:page
{:build/tags #{:user.class/Grnspechte-kAb3rnMZ},
:build/properties
{:user.property/Gre-kWkFTZ_D 122,
:user.property/Bedroht-X7sIvDOk true,
:user.property/Farbe-Dcnb6mnk "Rot"},
:block/title "Günther Grünspecht"},
:blocks
[{:block/title "Er ist ein bunter Vogel. Sagt man auch."}]}],
:properties
{:user.property/Gre-kWkFTZ_D
{:db/cardinality :db.cardinality/one,
:logseq.property/type :number,
:block/title "Größe"},
:user.property/Bedroht-X7sIvDOk
{:db/cardinality :db.cardinality/one,
:logseq.property/type :checkbox,
:block/title "Bedroht"},
:user.property/Farbe-Dcnb6mnk
{:db/cardinality :db.cardinality/one,
:logseq.property/type :default,
:block/title "Farbe"}},
:classes
{:user.class/Grnspechte-kAb3rnMZ
{:block/title "Grünspechte",
:block/collapsed? false,
:build/class-extends #{:user.class/Vgel-Q0C0b7jy}},
:user.class/Vgel-Q0C0b7jy {:block/title "Vögel"}},
:logseq.db.sqlite.export/export-type :page}
```

2. Import page again

### Expected Behavior

The properties get updated, not duplicated. So why not the content?

I'm not sure what the best behavior would be.

A user might want to have multiple identical blocks? Like with running the CLI block upsert multiple times.

But usually i think not changing the content when the data from the import is already there would be preferable.

But a user might have the same journal line multiple times, because it happened multiple times. I had that in some cases.

We have the same data sync conflict resolution problem here.

Maybe don't duplicate if the whole page content is identical? But leave single lines alone when being present multiple times.

### Screenshots

_No response_

### Files

_No response_

### Browser, Desktop or Mobile Platform Information

NixOS 25.11.10684.8fd9daa3db09
Logseq-linux-x86_64-2.0.1-alpha+nightly.20260622

### Additional Context

Users where asking in Discord how they can merge graphs. This might lead to unexpected results.

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

No files, tests, or entry points are identified. Reproduce the issue by importing the supplied EDN page twice into a clean graph, then trace the page import path and determine the intended behavior for identical pages versus repeated identical blocks; done means the chosen behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Domain
database
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.