-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
feat(gatsby): support named splats in functions #33301
Conversation
exports[`develop dynamic routes unnamed wildcard routes 1`] = ` | ||
Object { | ||
"*": "super", | ||
"0": "super", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
send the path-to-regexp param style route so we avoid a breaking change until v5.
Can you please also update any relevant documentation for this? I think we somewhere note that we don't support this and/or the syntax needs change. |
We never did support dynamic routing for functions in cloud so we removed the docs for launch — @dmccraw is working on adding that which actually is what prompted noticing that we were missing support for named splats in the framework. When we add back the docs, let's make sure to add docs for this too. |
Great to see this being supported! I tried using dynamic routing in my entry for the FuncJam. TLDR;
|
Seems like a valid error in the integration tests. I would also suggest moving to inlineSnapshot for the one small snapshots, it will make the tests a little bit more clear |
Turns out I'd just missed committing my new function file 🤦 |
Switch from using path-to-regexp to @reach/router to do matches so we're we use the same route matching lib as elsewhere + to add support for named splats (path-to-regexp only support `/foo/*` not `/foo/*bar`.
471679a
to
e90ba87
Compare
Thanks for finishing this out @wardpeet ! |
Co-authored-by: Ward Peeters <[email protected]> (cherry picked from commit 018c041)
Co-authored-by: Ward Peeters <[email protected]> (cherry picked from commit 018c041) Co-authored-by: Kyle Mathews <[email protected]>
Co-authored-by: Ward Peeters <[email protected]>
Co-authored-by: Ward Peeters <[email protected]>
Switch from using path-to-regexp to @reach/router to do matches so we're we use the same route matching lib as the client and to add support for named splats e.g.
/foo/[...bar].js
(path-to-regexp nameless splats like/foo/[...].js
.