mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-07 04:12:04 +00:00
The client bundle carries only the active locale — resolved on the server and handed to the provider with no hydration flash, halving the dashboard route to under a megabyte parsed (288 KiB gzip). The auth shell renders the app chrome immediately instead of a spinner while the session resolves in parallel, the widgets request folds into the snapshot it duplicated, and insight pills prefetch their sub-pages — a first visit to a sub-page lands in about ninety milliseconds instead of nearly a second.
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
/**
|
|
* Unit-test setup.
|
|
*
|
|
* Seed the client-side locale cache with every message bundle. In
|
|
* production only EN ships statically; the active locale arrives as an
|
|
* RSC prop from the root layout and other locales load via dynamic
|
|
* import on switch (see `src/lib/i18n/load-locale.ts`). Tests mount
|
|
* `I18nProvider` standalone — often with `renderToStaticMarkup`, which
|
|
* is synchronous and cannot await a dynamic import — so the cache is
|
|
* primed up front and `t()` resolves every locale on the first render,
|
|
* exactly like the server-handoff path does in the app.
|
|
*/
|
|
import { primeMessages } from "@/lib/i18n/load-locale";
|
|
import deMessages from "./messages/de.json";
|
|
import enMessages from "./messages/en.json";
|
|
import esMessages from "./messages/es.json";
|
|
import frMessages from "./messages/fr.json";
|
|
import itMessages from "./messages/it.json";
|
|
import plMessages from "./messages/pl.json";
|
|
|
|
primeMessages("de", deMessages);
|
|
primeMessages("en", enMessages);
|
|
primeMessages("es", esMessages);
|
|
primeMessages("fr", frMessages);
|
|
primeMessages("it", itMessages);
|
|
primeMessages("pl", plMessages);
|