From 9930d19ba4387a2b095b1961bf155e8dac77c776 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Sat, 4 Jul 2026 15:21:11 +0200 Subject: [PATCH] fix: keep advanced search filters applied when switching folders #553 --- app/(main)/[locale]/page.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/app/(main)/[locale]/page.tsx b/app/(main)/[locale]/page.tsx index 3bb938a0..67699187 100644 --- a/app/(main)/[locale]/page.tsx +++ b/app/(main)/[locale]/page.tsx @@ -1727,7 +1727,15 @@ export default function Home() { setTabletListVisible(true); } if (viewingClient) { - await fetchEmails(viewingClient, mailboxId); + // Keep an active search applied when switching folders (#553); the + // store actions resolve the viewing account's client internally. + if (!isFilterEmpty(searchFilters)) { + await advancedSearch(viewingClient); + } else if (searchQuery) { + await searchEmails(viewingClient, searchQuery); + } else { + await fetchEmails(viewingClient, mailboxId); + } } }; @@ -1817,8 +1825,13 @@ export default function Home() { } if (client) { - // If there's an active search, re-run it in the new mailbox - if (searchQuery) { + // If there's an active search, re-run it in the new mailbox. Advanced + // filters must go through advancedSearch (which also includes the text + // query) — falling back to fetchEmails would silently drop them while + // the UI still shows them as active (#553). + if (!isFilterEmpty(searchFilters)) { + await advancedSearch(client); + } else if (searchQuery) { await searchEmails(client, searchQuery); } else { await fetchEmails(client, mailboxId);