File tree 2 files changed +17
-1
lines changed
2 files changed +17
-1
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @cloudflare/next-on-pages ' : patch
3
+ ---
4
+
5
+ Add support for dynamic route params
Original file line number Diff line number Diff line change @@ -159,10 +159,21 @@ export default {
159
159
pathname . replace ( __BASE_PATH__ , '/' ) . replace ( '//' , '/' )
160
160
: pathname ;
161
161
162
+ const nextPathnameMatcher = nextPathname . match ( regexp ) ;
163
+
162
164
if (
163
- nextPathname . match ( regexp ) ||
165
+ nextPathnameMatcher ||
164
166
`${ nextPathname } /page` . replace ( '//page' , '/page' ) . match ( regexp )
165
167
) {
168
+ if ( nextPathnameMatcher ?. groups ) {
169
+ const params = Object . entries ( nextPathnameMatcher . groups ) ;
170
+ const urlWithParams = new URL ( request . url ) ;
171
+ for ( const [ key , value ] of params ) {
172
+ urlWithParams . searchParams . set ( key , value ) ;
173
+ }
174
+ request = new Request ( urlWithParams . toString ( ) , request ) ;
175
+ }
176
+
166
177
found = true ;
167
178
break ;
168
179
}
You can’t perform that action at this time.
0 commit comments