Data Fetching and Loading States Differences with PWA Kit

PWA Kit follows a fetch-on-render model where hooks request data during component render and expose manual loading flags. Storefront Next follows fetch-then-render with route loaders that gather data before component rendering, enabling Suspense and streaming patterns more naturally. This moves data concerns out of presentation components and simplifies loading orchestration.

PWA Kit and Storefront Next handle loading states with different models. PWA Kit relies on manual conditional rendering, while Storefront Next uses React Suspense for declarative loading boundaries. PWA Kit’s approach gives explicit control through React Query’s isLoading flags and conditional rendering. Storefront Next’s Suspense-based approach keeps components focused on rendering with data while boundaries handle loading automatically. That reduces boilerplate and enables streaming, but it requires understanding Suspense patterns and React 19’s use() hook.

AspectPWA KitStorefront Next
Data LocationInside components (hooks)Outside components (loaders)
DiscoveryAutomatic (hook scanning)Explicit (route exports)
FeaturePWA KitStorefront Next
SSR ApproachReact Query auto-discoveryLoader functions
Client NavigationReact Query refetchClient loader
Legacy SupportgetProps static methodN/A
CachingReact Query cacheManual / React Router
FeaturePWA KitStorefront Next
Pre-fetch ProcessingExpress middlewareReact Router middleware
Shared StateExpress res.localsRouter context
Request AccessFull Express req/resFetch API Request
AspectPWA KitStorefront Next
ApproachManual conditional renderingDeclarative Suspense boundaries
Loading detectionisLoading flags from hooksuse() hook suspends on pending promises
Skeleton displayExplicit if (isLoading) checksAutomatic via Suspense fallback
Multiple regionsManual state tracking per regionMultiple <Suspense> boundaries
Navigation transitionskeepPreviousData optiongetPageKey + shouldRevalidate
Code splitting@loadable/component fallbackReact Router automatic splitting
Skeleton stylingChakra <Skeleton> componentTailwind animate-pulse
StreamingLimitedNative promise streaming

PWA Kit — imperative:

Storefront Next — declarative:

PWA Kit can experience client-side waterfalls when data-fetching hooks depend on each other:

Storefront Next enables streaming where data resolves as it’s ready:

PWA Kit and Storefront Next have these data fetching capabilities.

  • Server-side rendering.
  • Fetching data from any data source.
  • Setting response headers.
  • Middleware/pre-processing capabilities.

When converting your storefront from PWA Kit to Storefront Next, keep these tips in mind.

  • Move data fetching to loaders: Extract useQuery calls into loader functions.
  • Replace React Query: Use loader returns instead of hooks.
  • Conditional rendering → Suspense: Replace if (isLoading) patterns with Suspense boundaries and the createPage factory.
  • Update loading states: Replace isLoading conditionals with Suspense fallbacks.
  • keepPreviousDatashouldRevalidate: Move “keep old data visible” logic from React Query options to router revalidation control.
  • Loading spinners → skeleton fallbacks: Convert inline loading spinners to skeleton components in Suspense fallbacks.
  • Multiple loading states → multiple boundaries: Split single-page loading into independent Suspense regions for granular streaming.
  • Convert middleware: Express middleware becomes React Router middleware.
  • Update request access: Use Fetch API Request instead of Express req.