Open ethanniser opened 5 months ago
Thanks a lot for the speedy assist @ethanniser , it seems to work great.
The naming is certainly tricky as import { withParamValidation as withParamValidation2 }
feels bad and lacks auto-import. I expect it will be common to importing both of these higher order functions in dynamic pages, so some clarity around naming feels important for DX.
I imagine you want to prevent breaking changes to the original withParamValidation
by renaming that in the short term – but that name may be a bit ambiguous when using both of these simultaneously. Long-term that might become hocWithParamValidation
or withParamValidationHoc
?
And perhaps this becomes generateMetadataWithParamValidation
or withParamValidationGenerateMetadata
?
Just some ideas, for the time being this is good enough to work with so thanks again.
Looks good! Thanks for fixing that.
I think either of Adam's naming suggestions would be just fine.
closes #92
This PR: Adds support for a new higher order function wrapping Next's generateMetadata() to add the same parsing for route/search params as in the normal page component
the function is basically identical to the existing
withParamValidation
but without the react stuff required for higher order components (check out the example!)right now ive named it also
withParamValidation
and put it innext-typesafe-url/app
but this leads to a name conflict in its intended usecase (again see example)TODO!
[ ] Decide on how to name / where to put this function
[ ] Make sure it works (@adamkangas @jac0bbennett if you could test this out its live on
4.0.7-beta.3
now)[ ] Update docs
[ ] (if ready to be merged) Yes I have made a changeset (still work todo)