#44

Fix Google setup mail shell loading

MergedstylesshOwnermerged intofrom

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 lint
  • pnpm typecheck
  • pnpm test (169 passing)
  • DEMO_MODE=true pnpm build
  • git diff --check

Activity

5
stylessh merged commit 40b4a27 into main2mo ago
Git branch
stylessh deleted stylessh/fix-google-mail-shell branch2mo ago
mikey2mo 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: hostedSetup gate correctly matches resolveMailAccount's hosted-account shape (connector: "hosted", status: "setup" when no mailbox exists yet, per lib/mail/accounts.ts). Skipping loadFolderCounts/loadMailCollections in this case avoids routing through createStalwartProvider for an account with no mailbox — this previously would have thrown inside app/mail/settings/layout.tsx (which also mounts MailAccountShell with 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>) matches FolderCounts exactly, and the cast is sound given mailFolderIds is derived from the same union.
  • app/mail/error.tsx / mail-shell-loading.tsx: MailShellError is a straight relocation of the old MailRouteError (confirmed no other references to the removed export remain), now reconstructing the full shell frame (sidebar + tab bar) to match MailShellLoading's structure instead of rendering a bare pane — this fixes the previously bare-looking crash screen, since app/mail/error.tsx is the only error boundary in the /mail subtree and unmounts the entire AppShell layout on any error (e.g. from loadFolderPage/loadMailCollections still 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} on ThreadListSkeletonRows is a cosmetic-only change (verified against the count = 8 default); no behavior change.
  • Removed Button import in app-shell.tsx has 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 the hostedSetup branch 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.tsx and [folder]/page.tsx, app/mail/settings/layout.tsx, and grepped for other references to the removed MailRouteError export.

Branch stylessh/fix-google-mail-shell has been deleted.