From c8e6371793851fc547443e7d38f165a25bfb5d59 Mon Sep 17 00:00:00 2001 From: Matt Date: Sun, 10 May 2026 12:27:49 +0200 Subject: [PATCH] fix(documents): reset type filter on tab/folder switch + label chips MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Switching tab or folder while a type filter was active left the filter applied silently — the chip cloud regenerated from the new result set so no chip lit up, but the documentType= query param kept narrowing the list. Reset typeFilter to undefined whenever tab or selected folder changes. Also use TYPE_LABELS for chip text so the filter chips match the human-readable labels already shown in the row's Type column. Co-Authored-By: Claude Opus 4.7 (1M context) --- src/components/documents/documents-hub.tsx | 25 +++++++++++++++------- 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/src/components/documents/documents-hub.tsx b/src/components/documents/documents-hub.tsx index 54431e39..ee270e93 100644 --- a/src/components/documents/documents-hub.tsx +++ b/src/components/documents/documents-hub.tsx @@ -211,22 +211,27 @@ export function DocumentsHub({ portSlug, initialTab = 'all' }: DocumentsHubProps ); }; + const handleFolderSelect = (id: string | null | undefined) => { + setSelectedFolderId(id); + setTypeFilter(undefined); + }; + return (
setSelectedFolderId(undefined)} + onAfterDelete={() => handleFolderSelect(undefined)} /> } />
- + - setTab(v as DocumentsHubTab)}> + { + setTab(v as DocumentsHubTab); + setTypeFilter(undefined); + }} + > {documentsHubTabs.map((t) => ( @@ -285,9 +296,7 @@ export function DocumentsHub({ portSlug, initialTab = 'all' }: DocumentsHubProps className="max-w-xs h-9" /> {(() => { - const seenTypes = Array.from( - new Set(documents.map((d) => d.documentType)), - ).sort(); + const seenTypes = Array.from(new Set(documents.map((d) => d.documentType))).sort(); if (seenTypes.length === 0) return null; return (
@@ -311,7 +320,7 @@ export function DocumentsHub({ portSlug, initialTab = 'all' }: DocumentsHubProps )} onClick={() => setTypeFilter(t)} > - {t} + {TYPE_LABELS[t] ?? t} ))}