Repository navigation
feat(capture): sort list properties written by property Capture - #2237
Conversation
Property Capture gets a "Sort list" setting: Keep order (default),
Ascending, or Descending. Sorting applies to every list the Capture
writes (Add to list, Set value on a list, and {{PROPERTY}} formats),
after new items are merged and duplicates removed. Items sort in
natural text order, so YYYY-MM-DD dates sort chronologically and
"item 2" comes before "item 10".
Settings saved without a sort load as Keep order, so existing
Captures behave as before.
Refs #2236
Deploying quickadd with
|
| Latest commit: |
0bd3b1e
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://3520d7f0.quickadd.pages.dev |
| Branch Preview URL: | https://issue-2236.quickadd.pages.dev |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info
📝 Walkthrough
Merge Risk: ⚪ Minimal · up to
|
|
Verifier verdict: FAIL for head 0bd3b1e against base 45cd3fb. Every run-path claim holds in real Obsidian 1.13.7. One user-visible defect blocks: the Capture builder shows an empty Sort list dropdown for any property Capture saved before this change. Defect (medium). Evidence. All scenarios ran through the repo's E2E runner on the isolated vault. Each
Commands run: |
… list Saved choices reach the builder without passing through parsePropertyCapture, so a property Capture saved before this setting existed had no sort. The Sort list dropdown rendered blank and the Add to list description dropped its ordering note. The builder now fills in Keep order when it opens, like its other legacy defaults.
|
Verifier verdict (round 2): PASS+NOTES for head 4965654 against base 45cd3fb. The round 1 defect is fixed on the real surface, and nothing else regressed. One note on persistence at the end. Evidence, all in Obsidian 1.13.7 through the repo's E2E runner on the isolated vault:
Note (low, no action needed in this PR). Opening the legacy choice and leaving without touching anything does not write |
Property Capture gets a Sort list setting: Keep order (default), Ascending, or Descending. Refs #2236.
Product decision
Sorting: added, as one generic option. Property Capture already merges captured items into a list and removes duplicates. Keeping that list ordered is the last step of the same job, and today it needs a user script. Sorting helps tags, aliases, links, and logs, not only date lists.
{{PROPERTY}}. It runs after merging and duplicate removal.Intl.Collator, numeric).YYYY-MM-DDdates sort chronologically, anditem 2sorts beforeitem 10. There is no "sort by" picker, because QuickAdd writes these items in a format the user controls.Date-aware duplicate comparison: declined. Obsidian 1.13.7 reads unquoted dates in frontmatter as strings:
- 2026-10-10comes back as"2026-10-10". QuickAdd therefore never sees the non-string date values the issue describes. The remaining case is different spellings of one date (2026-10-11,2026-10-11T08:00). Handling it would need a date-list mode, format guessing, and a rule for which spelling survives. A consistent{{DATE:YYYY-MM-DD}}format never creates that data. The issue should stay open until a maintainer explains this decision, so this PR uses "Refs", not "Closes".Changes
PropertyCapture.sort("none" | "asc" | "desc") is required in memory.parsePropertyCapturesets it to"none"when it is missing, so saved Captures work as before.planPropertyUpdateremoves duplicates, then sorts, in one helper.Verification
pnpm run lint,pnpm run test(6888 passed, 28 skipped), andpnpm run buildpass.{{PROPERTY}}, an empty add, and settings parsing.tests/e2e/property-capture.test.tspasses in real Obsidian (.agents/run-e2e, 13 of 13).[2026-10-10, 2026-10-12]into[2026-10-10, 2026-10-11, 2026-10-12]. A second run returnedeffect: "unchanged". After Descending was selected in the builder,data.jsonsaved"sort": "desc", and the next run wrote the list in reverse order.Release and migration impact
No migration is needed. Settings without
sortload as Keep order.Note
Add list-sort setting (Keep order, Ascending, Descending) to property Capture
PropertyListSortsetting to property Capture with three modes: Keep order, Ascending, and Descending. Applies toAdd to list, typedSet, and composed{{PROPERTY}}writes.Intl.Collator(numeric-aware), so dates and numbers sort correctly. Scalar and multiline text values stay unsorted. See captureProperty.ts and ICaptureChoice.ts.Keep orderas the default for new and legacy choices.Keep order, so existing behavior is unchanged unless the user picks a sort mode.Macroscope summarized 4965654.
Summary by CodeRabbit