From d4b0cd5cc2becf14f9c04efce0aee37160ef0467 Mon Sep 17 00:00:00 2001 From: Test Date: Thu, 19 Mar 2026 03:28:29 +0100 Subject: [PATCH] fix: hide system properties (trashed, archived, icon) from Properties panel These properties have dedicated UI elsewhere (trash/archive banner, emoji picker) and should not appear as generic editable properties. Co-Authored-By: Claude Opus 4.6 (1M context) --- .../DynamicPropertiesPanel.test.tsx | 58 +++++++++++++++++-- src/hooks/usePropertyPanelState.ts | 5 +- 2 files changed, 56 insertions(+), 7 deletions(-) diff --git a/src/components/DynamicPropertiesPanel.test.tsx b/src/components/DynamicPropertiesPanel.test.tsx index da9e4c16..43eebccd 100644 --- a/src/components/DynamicPropertiesPanel.test.tsx +++ b/src/components/DynamicPropertiesPanel.test.tsx @@ -227,14 +227,14 @@ describe('DynamicPropertiesPanel', () => { ) // Boolean should show as Yes/No toggle const toggleBtn = screen.getByText('\u2717 No') fireEvent.click(toggleBtn) - expect(onUpdateProperty).toHaveBeenCalledWith('archived', true) + expect(onUpdateProperty).toHaveBeenCalledWith('published', true) }) it('renders array property as tag pills', () => { @@ -441,7 +441,7 @@ describe('DynamicPropertiesPanel', () => { ) @@ -450,7 +450,7 @@ describe('DynamicPropertiesPanel', () => { const input = screen.getByDisplayValue('false') fireEvent.change(input, { target: { value: 'true' } }) fireEvent.keyDown(input, { key: 'Enter' }) - expect(onUpdateProperty).toHaveBeenCalledWith('archived', true) + expect(onUpdateProperty).toHaveBeenCalledWith('draft', true) }) it('coerces numeric strings to numbers on save', () => { @@ -885,7 +885,7 @@ describe('DynamicPropertiesPanel', () => { ) @@ -894,6 +894,54 @@ describe('DynamicPropertiesPanel', () => { }) }) + describe('system property filtering', () => { + it('hides trashed, trashed_at, archived, archived_at, icon from properties panel', () => { + render( + + ) + expect(screen.queryByText('trashed')).not.toBeInTheDocument() + expect(screen.queryByText('trashed_at')).not.toBeInTheDocument() + expect(screen.queryByText('archived')).not.toBeInTheDocument() + expect(screen.queryByText('archived_at')).not.toBeInTheDocument() + expect(screen.queryByText('icon')).not.toBeInTheDocument() + // Custom property still visible + expect(screen.getByText('cadence')).toBeInTheDocument() + }) + + it('filters system properties case-insensitively', () => { + render( + + ) + expect(screen.queryByText('Trashed')).not.toBeInTheDocument() + expect(screen.queryByText('Archived')).not.toBeInTheDocument() + expect(screen.queryByText('Icon')).not.toBeInTheDocument() + expect(screen.getByText('cadence')).toBeInTheDocument() + }) + + it('does not filter similar but non-matching property names', () => { + render( + + ) + expect(screen.getByText('Is Trashed')).toBeInTheDocument() + expect(screen.getByText('archive_date')).toBeInTheDocument() + }) + }) + describe('display mode override', () => { beforeEach(() => { resetVaultConfigStore() diff --git a/src/hooks/usePropertyPanelState.ts b/src/hooks/usePropertyPanelState.ts index 01683d7e..5aef19e3 100644 --- a/src/hooks/usePropertyPanelState.ts +++ b/src/hooks/usePropertyPanelState.ts @@ -11,7 +11,8 @@ import { import { containsWikilinks } from '../components/DynamicPropertiesPanel' // Keys to skip showing in Properties (handled by dedicated UI or internal) -const SKIP_KEYS = new Set(['aliases', 'workspace', 'title', 'type', 'is_a', 'Is A']) +// Compared case-insensitively via isVisibleProperty() +const SKIP_KEYS = new Set(['aliases', 'workspace', 'title', 'type', 'is_a', 'is a', 'trashed', 'trashed_at', 'archived', 'archived_at', 'icon']) function coerceValue(raw: string): FrontmatterValue { if (raw.toLowerCase() === 'true') return true @@ -79,7 +80,7 @@ function collectAllVaultTags(entries: VaultEntry[] | undefined): Record