Skip to content

armgit / macro

Public Imported from GitHub
0

Macro is a unified workspace for teams: email, chat, docs, tasks, agents, calls, and CRM — @-linked together with shared AI memory.

fix(multi-inbox): unchecking the last inbox selects all instead of none (#4116)

gbirman46b703defe2d
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/inbox-selector.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/inbox-selector.tsx
index 1596b541d1..234b26bdc2 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/inbox-selector.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/inbox-selector.tsx
@@ -48,7 +48,7 @@ export function InboxSelector() {
<SearchableMultiSelect
options={picker.options}
activeIds={picker.activeIds}
- onChange={picker.onChange}
+ onChange={(ids) => (ids.length ? picker.onChange(ids) : picker.reset())}
onOnly={picker.selectOnly}
placeholder="Search inboxes..."
preserveOrder
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
index 4dcde9a931..bd528ec979 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/mobile-filter-drawer.tsx
@@ -121,11 +121,10 @@ export const MobileFilterDrawer = () => {
const toggleInbox = (id: string) => {
const current = picker.activeIds();
- picker.onChange(
- current.includes(id)
- ? current.filter((activeId) => activeId !== id)
- : [...current, id]
- );
+ const next = current.includes(id)
+ ? current.filter((activeId) => activeId !== id)
+ : [...current, id];
+ return next.length ? picker.onChange(next) : picker.reset();
};
const VIEW_SORT_OPTIONS: Partial<Record<ListView, SortOption[]>> = {
diff --git a/js/app/packages/app/component/next-soup/soup-view/filters-bar/search/search-facets.tsx b/js/app/packages/app/component/next-soup/soup-view/filters-bar/search/search-facets.tsx
index c8f3ec4d27..e1e6d0e25c 100644
--- a/js/app/packages/app/component/next-soup/soup-view/filters-bar/search/search-facets.tsx
+++ b/js/app/packages/app/component/next-soup/soup-view/filters-bar/search/search-facets.tsx
@@ -266,7 +266,8 @@ export function useSearchFacets(
label: 'Inbox',
options: inboxPicker.options,
activeIds: inboxPicker.activeIds,
- onChange: inboxPicker.onChange,
+ onChange: (ids) =>
+ ids.length ? inboxPicker.onChange(ids) : inboxPicker.reset(),
onOnly: inboxPicker.selectOnly,
placeholder: 'Search inboxes...',
preserveOrder: true,