-
The docs for getRouteNamespaces imply that it only returns the namespaces for the current request, however I'm finding it returns every namespace in my app. This causes the server to load a lot more namespaces from an http backend than necessary to serve the current request. Is this done on purpose or could I change it to use just the current route e.g. function getRouteNamespaces(context: EntryContext): string[] {
const namespaces = Object.values(
context.staticHandlerContext.matches
).flatMap((match) => {
const route = match.route;
if (typeof route?.handle !== "object") return [];
if (!route.handle) return [];
if (!("i18n" in route.handle)) return [];
if (typeof route.handle.i18n === "string") return [route.handle.i18n];
if (
Array.isArray(route.handle.i18n) &&
route.handle.i18n.every((value: string) => typeof value === "string")
) {
return route.handle.i18n as string[];
}
return [];
});
return [...new Set(namespaces)];
} |
Beta Was this translation helpful? Give feedback.
Answered by
sergiodxa
Dec 5, 2024
Replies: 1 comment
-
This should be fixed in v7 as RR only sends the manifest of the matching routes during SSR and not every route |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
sergiodxa
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This should be fixed in v7 as RR only sends the manifest of the matching routes during SSR and not every route