feat(search): add "clear search when switching folders" setting - #852
Open
shukiv wants to merge 1 commit into
Open
feat(search): add "clear search when switching folders" setting#852shukiv wants to merge 1 commit into
shukiv wants to merge 1 commit into
Conversation
Switching folders currently keeps an active search applied and re-runs it in the newly selected folder — deliberate behavior from bulwarkmail#553, where users wanted the query to follow them across folders. Others expect the opposite: clicking Inbox/Sent should drop the search and just browse the folder. Add an opt-in setting (Settings → email behavior) that reconciles both. Default is off, so bulwarkmail#553's search-follows-you behavior is unchanged for everyone. When on, any folder click clears the text query and advanced filters and browses the folder instead of re-running the search. Applied uniformly across the four folder-entry paths in MailApp — normal mailboxes, per-account (Pro sidebar) folders, unified views, and cross views — via one helper so no path diverges.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds an opt-in setting (Settings → email behavior → "Clear search when switching folders") that, when enabled, clears the active search (text query + advanced filters) on any folder click and browses that folder instead of re-running the search there.
Default: off — the current behavior is unchanged for everyone.
Why
#553 deliberately made an active search follow you across folders (re-run in the newly selected folder), because users reported the search resetting was surprising. But the opposite expectation is just as common: clicking Inbox / Sent should drop the search and show the folder. Rather than flip #553, this makes it a per-user choice.
How
One helper,
clearSearchIfFolderChangeResets(), gates all four folder-entry paths inMailApp— normal mailboxes, per-account (Pro sidebar) folders, unified views, and cross views — so no path diverges. When the setting is off, every path behaves exactly as before (#553 preserved).Tag selection is intentionally out of scope — this only affects folder navigation.
Files
stores/settings-store.ts—clearSearchOnFolderChange: boolean(default false) + persistedcomponents/settings/reading-settings.tsx— togglelocales/en/common.json— English stringscomponents/mail/mail-app.tsx— helper + four gated branchesTesting
tsc --noEmitclean; ESLint clean on changed files.English locale only; other locales left for the usual translation sweep.