-
Notifications
You must be signed in to change notification settings - Fork 27.9k
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow for partial getStaticPaths
#14200
Comments
Note: This is made even more complicated given the fact that only certain users have access to certain Because all of our authentication sessions are stored client-side (i.e. we have a REST-ful API that accepts a JWT from the client), we can't SSR the whole dashboard (i.e. we can SSR the skeleton screen but all user-specific data must be fetched client-side). And then because of the restrictions of |
There's an open Discussion for this topic here: #14486 |
+1. Mainly chiming in to say that this feature would improve things a ton when it comes to translating dynamic routes (for instance with next-i18next@8). |
This issue was moved to a discussion.
You can continue the conversation there. Go to discussion →
Feature request
Is your feature request related to a problem? Please describe.
For the Tutorbook website (source available here), we have i18n setup such that each page has a
getStaticPaths
andgetStaticProps
that gets the translations for the currentlocale
. Ourpages
directory is setup like:But, we have a use case where we want an
[locale]/[org]/dashboard
route to use automatic static optimization for theorg
param only. That is, we want to statically fetch and render a skeleton screen with thelocale
query param and then use SWR to fetch theorg
specific data once Next.js hydrates the page client-side.I want a dashboard to be at
/[locale]/[org]/dashboard
but I want to statically pre-render a skeleton screen (i.e. when I don't knoworg
but I do knowlocale
) and then fetch the user's data client-side once Next.js hydrates the page and triggers an update to the query object (see this documentation).Describe the solution you'd like
Allow for
getStaticPaths
to output a subset of the dynamic path parameters and thengetStaticProps
has access to that subset of parameters. Next.js should then pre-render that page with the specified subset of parameters (i.e. pre-render a different dashboard skeleton screen for eachlocale
).Note: The dynamic path parameters specified by
getStaticPaths
should be higher up in the directory structure than any unspecified parameters (i.e. I can specify alocale
without specifying anorg
but I can't go the other way around).Then, all remaining dynamic path parameters (i.e. the
org
) are then provided client-side when Next.js hydrates the page (i.e. like it does currently with automatic static optimization).Describe alternatives you've considered
Currently, I'm forced to either SSR that page or fallback to the default locale (to pre-render that skeleton screen) until Next.js hydrates the page. Once Next.js hydrates the page, I now know
locale
and can manually fetch the necessary JSON translations. This is because we're forced by Next.js to provide all page routes when usinggetStaticPaths
(i.e. we can't just provide a locale, we have to provide a locale and a username).The text was updated successfully, but these errors were encountered: