fix: note list shows incomplete relationships when opening from sidebar

Two root causes:
1. noteListHooks used a stale selection.entry to build relationship groups —
   now looks up the fresh entry from the entries array so relationship updates
   propagate immediately.
2. frontmatterToEntryPatch didn't update entry.relationships — added
   RelationshipPatch support so frontmatter changes also update the
   relationships map in state.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
lucaronin
2026-03-20 03:26:52 +01:00
parent 51fc9298aa
commit 586e488072
7 changed files with 342 additions and 20 deletions

View File

@@ -56,7 +56,10 @@ export function useNoteListData({ entries, selection, query, listSort, listDirec
const searchedGroups = useMemo(() => {
if (!isEntityView) return []
const groups = buildRelationshipGroups(selection.entry, entries)
// Look up the fresh entry from the entries array to pick up relationship
// updates that happened after the selection was captured.
const freshEntry = entries.find((e) => e.path === selection.entry.path) ?? selection.entry
const groups = buildRelationshipGroups(freshEntry, entries)
return filterGroupsByQuery(groups, query)
}, [isEntityView, selection, entries, query])