Skip to content

fix(outliner): undo property cardinality one-to-many - #13480

Closed
tiensonqin wants to merge 1 commit into
masterfrom
logseq/fix-undo-property-cardinality-28e8
Closed

tiensonqin wants to merge 1 commit into
masterfrom
logseq/fix-undo-property-cardinality-28e8

Conversation

@tiensonqin

@tiensonqin tiensonqin commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Fixes logseq/db-test#1306

Undo of toggling a property from single to multiple values did nothing. The :upsert-property inverse already restored the previous schema (:db/cardinality :db.cardinality/one), but applying that inverse threw "Disallowed many to one conversion" whenever any values existed. History replay then failed and cleared the undo stack.

Change

  • Inverse of an existing-property :upsert-property now includes :allow-many-to-one? true.
  • upsert-property! honors that option when every entity still has at most one value, so undo restores both cardinality and the single-value shape.
  • Regular many-to-one updates with existing data still fail. History restore still fails if a block actually has multiple values.

Tests

  • Regression test in frontend.worker.undo-redo-test for the reported one-to-many undo/redo path, including poisoned raw tx so replay must use the semantic inverse.
  • logseq.outliner.property-test coverage for the restore option and the remaining many-to-one rejection cases.
  • Existing construct test updated for the inverse option.

Lambda Bug tracking id: 28155

Open in Web Open in Cursor 

Devin Review

Restore :db.cardinality/one and the single-value shape when undoing a
toggle to multiple values. The upsert-property inverse now allows that
safe many-to-one restore.

Co-authored-by: Tienson Qin <[email protected]>

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Devin Review

@tiensonqin

Copy link
Copy Markdown
Contributor Author

Shouldn't support reverting :many to :one.

@tiensonqin tiensonqin closed this Sep 30, 2026
@tiensonqin
tiensonqin deleted the logseq/fix-undo-property-cardinality-28e8 branch September 30, 2026 04:01
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.

Undo of changing a property to allow multiple values does nothing

2 participants