From c9435f75804e5665593bed8406e384d596cc3957 Mon Sep 17 00:00:00 2001 From: Linus Rath <139418639+rathlinus@users.noreply.github.com> Date: Thu, 21 May 2026 17:01:34 +0200 Subject: [PATCH] feat: always show unified mailbox in Pro shell --- app/(main)/[locale]/page.tsx | 8 +++++--- components/layout/sidebar.tsx | 6 +++++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/app/(main)/[locale]/page.tsx b/app/(main)/[locale]/page.tsx index 0b974798..d2da95da 100644 --- a/app/(main)/[locale]/page.tsx +++ b/app/(main)/[locale]/page.tsx @@ -884,15 +884,17 @@ export default function Home() { // Keep unified mailbox counts in sync when the feature is enabled and more // than one account is connected. Runs whenever the set of connected accounts // or the primary account's mailboxes change (a proxy for "something worth - // recounting happened"). + // recounting happened"). The Pro shell always renders the unified mailbox + // regardless of the user setting, so refresh when embedded too. useEffect(() => { - if (!enableUnifiedMailbox || !isAuthenticated || !client) return; + if (!enableUnifiedMailbox && !isEmbedded) return; + if (!isAuthenticated || !client) return; const built = buildUnifiedAccounts(); if (built.length < 2) return; populateUnifiedAccountMailboxes(built).then((populated) => { refreshUnifiedCounts(populated); }); - }, [enableUnifiedMailbox, isAuthenticated, client, mailboxes, connectedAccountsSignature, buildUnifiedAccounts, populateUnifiedAccountMailboxes, refreshUnifiedCounts]); + }, [enableUnifiedMailbox, isEmbedded, isAuthenticated, client, mailboxes, connectedAccountsSignature, buildUnifiedAccounts, populateUnifiedAccountMailboxes, refreshUnifiedCounts]); // System-notification click handler. The push SW navigates the user back // here with `?email=` (specific email it built the toast from) or diff --git a/components/layout/sidebar.tsx b/components/layout/sidebar.tsx index e7a51701..0b395750 100644 --- a/components/layout/sidebar.tsx +++ b/components/layout/sidebar.tsx @@ -736,7 +736,11 @@ export function Sidebar({ const tagCounts = useEmailStore(s => s.tagCounts); const accounts = useAccountStore(s => s.accounts); const connectedAccounts = accounts.filter(a => a.isConnected); - const showUnified = enableUnifiedMailbox && connectedAccounts.length > 1; + // Pro shell treats the unified mailbox as a core part of the multi-account + // UI, so it ignores the user-facing `enableUnifiedMailbox` toggle. The + // 2+ account requirement still applies — with a single account the + // unified counts would just duplicate that account's inbox. + const showUnified = (multiAccountMode || enableUnifiedMailbox) && connectedAccounts.length > 1; const { unifiedCounts } = useEmailStore(); const t = useTranslations('sidebar');