style: trim narration comments from recent changes
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0189ASmkMee4F5aJ3jnKeKQv
This commit is contained in:
@@ -41,7 +41,6 @@ export async function ensureMessages(locale: AppLocale): Promise<Messages> {
|
||||
const loader = catalogLoaders[`/src/locales/${locale}/messages.po`];
|
||||
if (!loader) return messageCache[DEFAULT_LOCALE]!;
|
||||
|
||||
// Dedupe concurrent loads; a rejected load is dropped so a retry can succeed.
|
||||
const pending = (inflightLoads[locale] ??= loader()
|
||||
.then(({ messages }) => {
|
||||
messageCache[locale] = messages;
|
||||
@@ -57,8 +56,6 @@ export function primeMessages(locale: AppLocale, messages: Messages) {
|
||||
messageCache[locale] ??= messages;
|
||||
}
|
||||
|
||||
// Seeded into the SSR-dehydrated query cache so hydration renders the active
|
||||
// locale without depending on a client-side catalog chunk load.
|
||||
export const i18nMessagesQueryKey = (locale: AppLocale) =>
|
||||
["i18n-messages", locale] as const;
|
||||
|
||||
|
||||
@@ -36,11 +36,6 @@ export const LinguiProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
const locale = resolveLocale(data?.metadata?.locale);
|
||||
const [catalogVersion, setCatalogVersion] = useState(0);
|
||||
|
||||
// Fresh instance per locale (and per SSR request tree). __root beforeLoad
|
||||
// dehydrates the active locale's catalog with the page, so hydration primes
|
||||
// it from the query cache and never regresses to en for the SSR'd locale.
|
||||
// Public routes (login) may still lack it — createI18n falls back to en
|
||||
// until the effect below loads it and bumps catalogVersion.
|
||||
const i18n = useMemo(
|
||||
() => {
|
||||
if (!hasCachedMessages(locale)) {
|
||||
@@ -59,8 +54,6 @@ export const LinguiProvider = ({ children }: { children: React.ReactNode }) => {
|
||||
if (hasCachedMessages(locale)) return;
|
||||
let cancelled = false;
|
||||
let retryTimer: ReturnType<typeof setTimeout> | undefined;
|
||||
// A failed chunk load must not strand the UI in en — retry until the
|
||||
// catalog arrives or the locale changes.
|
||||
const load = () => {
|
||||
ensureMessages(locale).then(
|
||||
() => {
|
||||
|
||||
Reference in New Issue
Block a user