You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
I have an API that is cursor paginated, but I would like to create a page-number based index page. Because getStaticProps only receives the page route params, I cannot achieve these nice URLs.
Describe the solution you'd like
Let me return a superset of the required params from getStaticPaths, then I can use those in getStaticProps.
e.g. route is /articles/page/[page]
Let me return the following from getStaticPaths: [{page: 1, cursor: undefined}, {page: 2, cursor: 'abc123'}]
Alternatives would be:
• redo all the pagination work again in gsProps which is wasteful
• have URLs like /articles/cursor/[cursor] which isn't as nice
This discussion was converted from issue #15465 on July 26, 2020 10:25.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Feature request
Is your feature request related to a problem? Please describe.
I have an API that is cursor paginated, but I would like to create a page-number based index page. Because
getStaticProps
only receives the page route params, I cannot achieve these nice URLs.Describe the solution you'd like
Let me return a superset of the required params from
getStaticPaths
, then I can use those ingetStaticProps
.e.g. route is
/articles/page/[page]
Let me return the following from getStaticPaths:
[{page: 1, cursor: undefined}, {page: 2, cursor: 'abc123'}]
so in
getStaticProps
I can do:const articles = await api.getAritclePage(limit: 12, startAfter: ctx.cursor)
Describe alternatives you've considered
Alternatives would be:
• redo all the pagination work again in
gsProps
which is wasteful• have URLs like
/articles/cursor/[cursor]
which isn't as niceAdditional context
None
Beta Was this translation helpful? Give feedback.
All reactions