From 2575238a011ed6fa7c571eaafab4b3efacf9f589 Mon Sep 17 00:00:00 2001 From: arkml <6592213+arkml@users.noreply.github.com> Date: Fri, 17 Jul 2026 16:03:52 +0530 Subject: [PATCH] fix(x): don't re-apply stale assistant email search on re-entering email view (#762) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The assistant's read-view email search stored its query in emailInitialSearchQuery and never cleared it, so every later visit to the email section remounted EmailView with the old query re-injected into the search box — even after the user had cleared it. Clear the stored query on any email navigation that doesn't carry an explicit search (sidebar, openEmailView) so deep-linked searches apply exactly once. Co-authored-by: Claude Fable 5 --- apps/x/apps/renderer/src/App.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/x/apps/renderer/src/App.tsx b/apps/x/apps/renderer/src/App.tsx index ca3971f5..75050533 100644 --- a/apps/x/apps/renderer/src/App.tsx +++ b/apps/x/apps/renderer/src/App.tsx @@ -4281,6 +4281,9 @@ function App() { setEmailInitialThreadId(threadId) setEmailThreadIdVersion((v) => v + 1) } + // Same reason as in navigateToView: a stale assistant-driven search must + // not repopulate the search box when the user re-enters the email view. + setEmailInitialSearchQuery(null) ensureEmailFileTab() }, [ensureEmailFileTab]) @@ -4455,6 +4458,10 @@ function App() { if (view.searchQuery) { setEmailInitialSearchQuery(view.searchQuery) setEmailSearchQueryVersion((v) => v + 1) + } else { + // Otherwise a past assistant-driven search would be re-applied on + // every re-entry, even after the user cleared the search box. + setEmailInitialSearchQuery(null) } ensureEmailFileTab() return