#44
Fix Google setup mail shell loading
Summary
- Keep identity-only Google sign-in usable while the hosted mailbox is still in setup.
- Render mail route failures inside the shell's content card.
- Extend the folder loading skeleton so it fills the content slot.
Validation
pnpm lintpnpm typecheckpnpm test(169 passing)DEMO_MODE=true pnpm buildgit diff --check
Activity
540b4a27 into main2mo agostylessh deleted
stylessh/fix-google-mail-shell branch2mo ago
Review summary
I traced the full data flow for the hosted-account "setup" state and confirmed this change is correct and low-risk:
mail-account-shell.tsx:hostedSetupgate correctly matchesresolveMailAccount's hosted-account shape (connector: "hosted",status: "setup"when no mailbox exists yet, perlib/mail/accounts.ts). SkippingloadFolderCounts/loadMailCollectionsin this case avoids routing throughcreateStalwartProviderfor an account with no mailbox — this previously would have thrown insideapp/mail/settings/layout.tsx(which also mountsMailAccountShellwith the hosted account id) even for pages that never touch mail content, e.g. Settings → Appearance/AI/Security for a brand-new Google-identity-only user.emptyFolderCounts's shape (Record<MailFolderId, number>) matchesFolderCountsexactly, and the cast is sound givenmailFolderIdsis derived from the same union.app/mail/error.tsx/mail-shell-loading.tsx:MailShellErroris a straight relocation of the oldMailRouteError(confirmed no other references to the removed export remain), now reconstructing the full shell frame (sidebar + tab bar) to matchMailShellLoading's structure instead of rendering a bare pane — this fixes the previously bare-looking crash screen, sinceapp/mail/error.tsxis the only error boundary in the/mailsubtree and unmounts the entireAppShelllayout on any error (e.g. fromloadFolderPage/loadMailCollectionsstill throwing on the actual folder route content for a setup-only hosted account — which is expected and now renders gracefully instead of the previous bug).loading-state.tsx:count={12}onThreadListSkeletonRowsis a cosmetic-only change (verified against thecount = 8default); no behavior change.Buttonimport inapp-shell.tsxhas no remaining usages there — clean removal, won't break the build.No blocking issues found. One non-blocking note: there's no test coverage (existing or new) for
MailAccountShell, so thehostedSetupbranch is only exercised by the manual validation steps listed in the PR description (build/lint/typecheck), not by an automated regression test. Not blocking given this component has no prior test coverage to extend, but worth a follow-up if this logic grows more branches.Verification performed: read the full diff,
lib/mail/accounts.ts,lib/mail/get-provider.ts,lib/mail/server.ts,lib/mail/routes.ts,lib/mail/types.ts,app/mail/a/[accountId]/layout.tsxand[folder]/page.tsx,app/mail/settings/layout.tsx, and grepped for other references to the removedMailRouteErrorexport.