Skip to content

Commit

Permalink
Normalize optional catch-all fallback: true page params (#17551)
Browse files Browse the repository at this point in the history
This makes sure to normalize the params for optional catch-all routes on Vercel since for `fallback: true` pages the `[[...paramName]]` value will be provided for the undefined/root param which needs to be normalized. 

Tests have been added in vercel/vercel#5247 and were manually tested with the changes in this PR with https://github.com/ijjk/next-update-loader

Fixes: #17220
x-ref: vercel/vercel#5247
  • Loading branch information
ijjk committed Oct 5, 2020
1 parent 782b7e4 commit b42be17
Showing 1 changed file with 6 additions and 1 deletion.
Expand Up @@ -89,7 +89,12 @@ const nextServerlessLoader: loader.Loader = function () {
(!value || (
Array.isArray(value) &&
value.length === 1 &&
value[0] === 'index'
${
''
// fallback optional catch-all SSG pages have
// [[...paramName]] for the root path on Vercel
}
(value[0] === 'index' || value[0] === \`[[...\${key}]]\`)
))
) {
value = undefined
Expand Down

0 comments on commit b42be17

Please sign in to comment.