#29
Show loading skeletons and prefetch open tabs
Summary
- render the existing inbox toolbar and message-row skeleton inside the initial mail shell instead of leaving its pane empty
- use that inbox skeleton as the folder route Suspense fallback during first loads and uncached folder changes
- use the existing conversation skeleton for cold conversation navigation instead of a blank pane
- fully prefetch restored conversation tabs as soon as they appear, so their URL-specific cached thread payloads are ready before the user switches tabs
Why
The data work was faster after the previous performance changes, but uncached loads could still leave the main pane visually empty while the server response streamed. These fallbacks provide immediate, layout-matched feedback without adding another request to the active route.
Restored workspace tabs previously used intent-only prefetching, so a reload did not warm their conversation payloads until hover or focus. The workspace rail is a small, bounded set of explicitly retained views, making it the right place to opt into Next's full per-link prefetch scheduler.
Verification
pnpm test(117 passed)pnpm exec tsc --noEmit- focused ESLint on all changed components
pnpm build- production-mode browser with a temporary 2.5-second mailbox delay: inbox skeleton remained visible, exposed
Loading messagesthrough a status region, then swapped to the real inbox witharia-busyremoved - production-mode browser after a hard reload with three restored conversation tabs: all three emitted full URL-aware RSC prefetch requests; switching to a prefetched tab emitted zero additional requests and rendered the cached conversation/title immediately
- current production baseline after the same hard reload: zero conversation-tab prefetch requests
- skeleton motion remains guarded by
prefers-reduced-motion: no-preference
Activity
7mikeyreviewed2mo ago
stylessh changed the title from Show inbox skeleton while mail loads to Show loading skeletons and prefetch open tabs2mo ago
2217dd1 into main2mo ago
Summary
Reviewed the diff for
app/mail/a/[accountId]/[folder]/page.tsx,app/mail/a/[accountId]/[folder]/thread/[threadId]/page.tsx, andcomponents/shell/mail-shell-loading.tsxagainst the existingcomponents/mail/loading-state.tsxskeleton components.page.tsxchanges (swappingfallback={null}for<MailFolderLoading />/<MailThreadLoading />) are straightforward and correct: both skeleton components already carryaria-busy, arole="status"live region, andaria-hiddenon the decorative bones, so they behave correctly when mounted directly as a Suspense fallback.mail-shell-loading.tsx's newpaneflex styles are needed forMailFolderLoading's internalflex: 1layout to size correctly and look right.MailShellLoadingmounts<MailFolderLoading />inside adivthat itself carriesaria-hidden, which silently dropsMailFolderLoading's own live-region announcement ("Loading messages") from the accessibility tree in that one call site. Behavior isn't broken today because the outer shell already exposes its own "Loading mail" status region, but worth a deliberate decision either way.No blocking correctness, security, or data-safety issues found. CI is green (
Validate applicationpassed; deploy jobs skipped as expected for a PR).