Commit 2e0cd92
fix(properties): de-duplicate canonical keys on parse to stop panel crash
Context:
parseFrontmatterProperties feeds propertiesStore (via parseAndSetProperties),
which PropertiesView renders with a keyed {#each (property.key)}. computeAndCache
canonicalizes every frontmatter key (e.g. the alias `color` -> `_color`).
Problem:
When a note's frontmatter contains both an alias and its canonical twin
(`color` + `_color`, `icon` + `_icon`, etc. -- common from external editors,
sync tools, or pre-migration notes), both keys canonicalize to the same name,
so the parser emitted two `_color` Property entries. The keyed {#each} then saw
two items with key `_color`, and Svelte's reconciler threw each_key_duplicate in
both dev and production. With no svelte:boundary in src/lib, the throw broke the
entire Properties panel render. serializeProperties already de-duplicated via
dedupeCanonicalKeys, but the parse path did not, so the store held the
collision.
Solution:
Apply the existing dedupeCanonicalKeys to the parsed properties inside
computeAndCache, before caching and returning. De-dup runs once per unique
frontmatter (on cache miss), so the cached value and every consumer get a single
entry per canonical key. Resolution matches serializeProperties: first populated
value wins, collisions are logged (never silent). Idempotent for collision-free
frontmatter, so all existing parse results are unchanged.
Behavior:
- `color: red` + `_color: blue` -> single `{ key: '_color', value: 'red' }`
entry (first appearance wins); panel renders instead of crashing.
- Collision-free frontmatter: unchanged.
Files:
- src/lib/features/properties/properties.logic.ts:146-151 — dedupeCanonicalKeys
applied in computeAndCache before caching/returning.
- src/tests/lib/features/properties/properties.logic.test.ts — regression test
asserting alias + canonical twin collapse to one entry.
- tasks/todo/bug-hunt-fixes.md — H5 marked done.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 07e772d commit 2e0cd92
3 files changed
Lines changed: 19 additions & 3 deletions
File tree
- src
- lib/features/properties
- tests/lib/features/properties
- tasks/todo
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
145 | 145 | | |
146 | 146 | | |
147 | 147 | | |
148 | | - | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
149 | 153 | | |
150 | | - | |
| 154 | + | |
151 | 155 | | |
152 | 156 | | |
153 | 157 | | |
| |||
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
184 | 184 | | |
185 | 185 | | |
186 | 186 | | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
187 | 199 | | |
188 | 200 | | |
189 | 201 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| |||
0 commit comments