Skip to content
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

getStaticPaths uses module’s path when returning params object #139

Open
eyelidlessness opened this issue Mar 16, 2021 · 1 comment
Open

Comments

@eyelidlessness
Copy link
Collaborator

Steps to reproduce

  1. Install microsite@next
  2. Create a page posts.tsx
  3. Follow these instructions from the docs
  4. Return { paths: [ { params: { id: '1' } }, { params: { id: '2' } } ] }
  5. 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 path template 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 🙂
@eyelidlessness
Copy link
Collaborator Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant