Skip to content

feat(search): add "clear search when switching folders" setting - #852

Open
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:feat/clear-search-on-folder-change
Open

feat(search): add "clear search when switching folders" setting#852
shukiv wants to merge 1 commit into
bulwarkmail:mainfrom
shukiv:feat/clear-search-on-folder-change

Conversation

@shukiv

@shukiv shukiv commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

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 in MailApp — 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.tsclearSearchOnFolderChange: boolean (default false) + persisted
  • components/settings/reading-settings.tsx — toggle
  • locales/en/common.json — English strings
  • components/mail/mail-app.tsx — helper + four gated branches

Testing

English locale only; other locales left for the usual translation sweep.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant