-
Notifications
You must be signed in to change notification settings - Fork 11
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
Feature Request: Allowing "Generate params from the top down" for route with multiple dynamic segments #242
Comments
Hi @zto-sbenning, I checked your proposal and it makes sense to me. Thank you for pointing this out 👍 It would be great if you can create a PR for this. Please let me know in case of any guidance needed 🙂 but seems straightforward. |
Hi, I would be very happy to contribute to your project with this PR. In fact, there is an open issue on Nextjs to fully support this "top down" pattern:
The workaround to be able to use this pattern is to use But it appear that So, I'm wondering if it best to open a new issue, and another PR for this, or should I propose a PR for this issue (
Happy to have your thought on this. |
I would prefer to split it to 2 issues. If I am not mistaken we can do the layout PR but need to wait with parent params PR. Just because "passing parent params" is dependant on that nextjs API change that is yet to be merged. IMO better to wait for them to fix it and update next-roots after that. What do you think? |
Tank you for the quick feedback! Well, it is not really dependant. As for now, we can still access the parent params in the page So if we can do both PR right now, we can acheive "Generate params from the top down" the same way plain Nextjs is currently doing (from layouts to pages). But I totally agree for making it in two separate PRs. Ok for you ? |
I see, ok for me 👍 |
Nextjs allows to use "Generate params from the top to down" pattern. To do this, the generated `generateStaticParams` must pass the `params` it receives to the original function. fix svobik7#242
# [3.10.0](v3.9.0...v3.10.0) (2024-07-24) ### Features * **templates:** support: passing the received params to the origin `generateStaticParams` function ([56cad89](56cad89)), closes [#242](#242)
🎉 This issue has been resolved in version 3.10.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Hi,
In the NextJS documentation, their is two ways to handle Multiple Dynamic Segments in a Route .
Generate params from the bottom up As I understand, this is what the generated code by next-roots expects.
Generate params from the top down As I understand, this is not possible with the current generated code, because it does not pass the received
params
.I think it would be nice to add this.
From my point of view, it would require modifying the generated code for
generateStaticParams
from:to:
And also modifying the type for
GenerateStaticParamsProps
and for geting strong typing amongparams
.What is your thought on this ?
I can try to do a PR for this if needed.
Cheers,
The text was updated successfully, but these errors were encountered: