From ce2b8f6ab0e48d80c36ca1d231b6be114ea6ebe4 Mon Sep 17 00:00:00 2001 From: Jean-Baptiste PENRATH Date: Tue, 7 Jul 2026 08:41:42 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=B8(frontend)=20reset=20search=20on=20?= =?UTF-8?q?mailbox=20switch=20(#743)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the user switches to anoter mailbox while it is on a search view, we reset search params and go to to the inbox as it does not make sens to keep search params on the new mailbox --- .../src/features/layouts/components/mailbox-panel/index.tsx | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/frontend/src/features/layouts/components/mailbox-panel/index.tsx b/src/frontend/src/features/layouts/components/mailbox-panel/index.tsx index 8dac5629..35b02bc9 100644 --- a/src/frontend/src/features/layouts/components/mailbox-panel/index.tsx +++ b/src/frontend/src/features/layouts/components/mailbox-panel/index.tsx @@ -6,6 +6,7 @@ import { useNavigate } from "@tanstack/react-router"; import { useUrlSearchParams } from "@/hooks/use-url-search-params"; import { useLayoutContext } from "@/features/layouts/components/layout-context"; import { MailboxLabels } from "./components/mailbox-labels"; +import { MAILBOX_FOLDERS } from "./components/mailbox-list"; import { Group, Panel, Separator, useDefaultLayout } from "react-resizable-panels"; import { MailboxSelector } from "@/features/layouts/components/mailbox-selector"; @@ -31,7 +32,10 @@ export const MailboxPanel = () => { selectedMailbox={selectedMailbox} onSelect={(mailboxId) => { closeLeftPanel(); - navigate({ to: '/mailbox/$mailboxId', params: { mailboxId }, search: Object.fromEntries(searchParams) }); + const search = searchParams.has("search") + ? MAILBOX_FOLDERS()[0].filter + : Object.fromEntries(searchParams); + navigate({ to: '/mailbox/$mailboxId', params: { mailboxId }, search }); }} />