From bccc0ceed46b5101d5936ffd02dbce05e7792a05 Mon Sep 17 00:00:00 2001 From: Test Date: Sat, 28 Feb 2026 20:08:55 +0100 Subject: [PATCH] fix: show type icon and label for "Note" type in search and autocomplete The "Note" type was explicitly filtered out with `isA !== 'Note'` in SearchPanel, NoteAutocomplete, and useNoteSearch, preventing its icon and label from appearing. Remove this special-casing so all types display consistently. Co-Authored-By: Claude Opus 4.6 --- src/components/NoteAutocomplete.tsx | 2 +- src/components/SearchPanel.tsx | 2 +- src/hooks/useNoteSearch.test.ts | 8 ++++---- src/hooks/useNoteSearch.ts | 2 +- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/NoteAutocomplete.tsx b/src/components/NoteAutocomplete.tsx index 45ecd7fd..c73f6f67 100644 --- a/src/components/NoteAutocomplete.tsx +++ b/src/components/NoteAutocomplete.tsx @@ -37,7 +37,7 @@ function matchEntries(entries: VaultEntry[], typeEntryMap: Record { const isA = e.isA const te = typeEntryMap[isA ?? ''] - const noteType = isA && isA !== 'Note' ? isA : undefined + const noteType = isA || undefined return { title: e.title, noteType, diff --git a/src/components/SearchPanel.tsx b/src/components/SearchPanel.tsx index 2d7f166d..093bc7dc 100644 --- a/src/components/SearchPanel.tsx +++ b/src/components/SearchPanel.tsx @@ -193,7 +193,7 @@ function SearchContent({ {results.map((result, i) => { const entry = entryLookup.get(result.path) const isA = entry?.isA ?? result.noteType - const noteType = isA && isA !== 'Note' ? isA : null + const noteType = isA || null const te = typeEntryMap[isA ?? ''] const typeColor = noteType ? getTypeColor(isA, te?.color) : undefined const TypeIcon = getTypeIcon(isA ?? null, te?.icon) diff --git a/src/hooks/useNoteSearch.test.ts b/src/hooks/useNoteSearch.test.ts index a45a43b0..c440d4ef 100644 --- a/src/hooks/useNoteSearch.test.ts +++ b/src/hooks/useNoteSearch.test.ts @@ -69,12 +69,12 @@ describe('useNoteSearch', () => { expect(project?.typeLightColor).toBeTruthy() }) - it('excludes noteType and light color for Note entries', () => { + it('includes noteType and colors for Note entries', () => { const { result } = renderHook(() => useNoteSearch(entries, '')) const note = result.current.results.find((r) => r.title === 'Beta Notes') - expect(note?.noteType).toBeUndefined() - expect(note?.typeColor).toBeUndefined() - expect(note?.typeLightColor).toBeUndefined() + expect(note?.noteType).toBe('Note') + expect(note?.typeColor).toBeTruthy() + expect(note?.typeLightColor).toBeTruthy() }) it('includes original VaultEntry in results', () => { diff --git a/src/hooks/useNoteSearch.ts b/src/hooks/useNoteSearch.ts index 5152a077..3302ccdd 100644 --- a/src/hooks/useNoteSearch.ts +++ b/src/hooks/useNoteSearch.ts @@ -12,7 +12,7 @@ export interface NoteSearchResult extends NoteSearchResultItem { } function toResult(e: VaultEntry, typeEntryMap: Record): NoteSearchResult { - const noteType = e.isA && e.isA !== 'Note' ? e.isA : undefined + const noteType = e.isA || undefined const te = typeEntryMap[e.isA ?? ''] return { entry: e,