Browse docs

Configuration

Loading Strategies

ReactVanilla

loadingStrategy in stift.config.ts decides what loads when. initialize({ locale, critical }) resolves once the critical namespaces are memory-loaded; the rest continues in the background.

The three strategies

  • 'lazy-per-namespace' (default) — load on first t(). Smallest boot cost; individual components suspend (or show raw-key fallback) as their namespaces stream in.
  • 'critical-then-full-background' — the PWA sweet spot: load critical, swap locale, persist the rest in the background.
await Stift.initialize({
  locale,
  critical: ['app-shell'], // NamespaceId[] to block first paint on
})
// initialize resolves once critical is ready; the full background pass continues.
  • 'boot-all' — pin every namespace (minus bootExclude) before first paint. Heaviest but zero jank; suited to kiosk/embedded surfaces where a loading state is unacceptable.

Bounded memory

memory.preload pins LRU-exempt namespaces; everything else lives under maxCachedNamespaces with evictionPolicy: 'lru'. The cache is bounded by construction — loading more locales can't grow memory without limit.

How it plays with offline

Returning visitors fast-path: installed packs verify + activate from the persister with zero network. Strategy and persistence compose — boot from cache instantly (offline-first), then revalidate in the background. Patterns: Offline & Persistence. Staleness checks: Updates & Invalidation.

Next