Share translations between pages and avoid redundant rsc payloads #1157
gkielwasser
started this conversation in
General
Replies: 1 comment 4 replies
-
Interesting question! I tried this in the App Router example and while I can reproduce this in production, I somehow don't see this behavior in development. In development, it seems like Next.js doesn't refetch the RSC payload for Client Components that are returned from a shared layout. I'm wondering if this is a bug in Next.js. Maybe this could be raised on the Next.js side, ideally with a reduced reproduction that doesn't use |
Beta Was this translation helpful? Give feedback.
4 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Can we have common translations that are shared accross pages and translations that are dedicated to page?
The shared layout would load the common translations and the page would load their dedicated extra translations.
While the following code enables translations, when navigating between pages that share the same layout, common translations are repeatedly requested. These common translations are included in each page RSC payload.
Is there a recommended pattern to prevent common translations from being included in each page's RSC payload once the shared layout is retrieved on the client side?
/[lang]/layout
/[lang]/layout/page-1 | /[lang]/layout/page-2
Here after we have loaded the "page-1" and we do a transition to the "page-2", page-2 rsc paload will contains the common translations. I would like that it contains only the one related to the "page-2"
In case we use a client shared layout, the common translations would be exclusively in the layout and won't be asked going to another page. But then, how can we populate the provider?
Beta Was this translation helpful? Give feedback.
All reactions