fix(x): don't re-apply stale assistant email search on re-entering email view (#762)

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 <noreply@anthropic.com>
This commit is contained in:
arkml 2026-07-17 16:03:52 +05:30 committed by GitHub
parent 826bce90ad
commit 2575238a01
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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