microsite
microsite copied to clipboard
getStaticPaths uses module’s path when returning params object
Steps to reproduce
- Install
microsite@next - Create a page
posts.tsx - Follow these instructions from the docs
- Return
{ paths: [ { params: { id: '1' } }, { params: { id: '2' } } ] } - Build
Expected result
Two pages will be built, with their respective content:
-
/posts/1.html -
/posts/2.html
Observed result
Both pages will be built at posts.html, with whichever finished last winning.
Notes and workaround
- The non-params string version worked as expected for me.
- The
pathtemplate static typing is cool, and it’s awesome to see that TS feature used in the wild! However, it loses inference on any other returned params. - I’m happy to take a look at both issues if I’m able to come up for air this weekend 🙂
However, it loses inference on any other returned params.
To clarify why this might matter, I had originally intended to provide the expected path params but also preserve some intermediate metadata for getStaticProps. Recreating that was trivial for my use case, but may be expensive for other projects.