Skip to content

Commit

Permalink
fix: data route rewrite for i18n root route (#2002)
Browse files Browse the repository at this point in the history
* fix: data route rewrite for i18n root route

* chore: update snapshots for new rewrite
  • Loading branch information
orinokai committed Mar 22, 2023
1 parent 92e209f commit 4f6cdd9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/runtime/src/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export const generateNetlifyRoutes = ({
}) => [...(withData ? toNetlifyRoute(dataRoute) : []), ...toNetlifyRoute(route)]

export const routeToDataRoute = (route: string, buildId: string, locale?: string) =>
`/_next/data/${buildId}${locale ? `/${locale}` : ''}${route === '/' ? '/index' : route}.json`
`/_next/data/${buildId}${locale ? `/${locale}` : ''}${route === '/' ? (locale ? '' : '/index') : route}.json`

// Default locale is served from root, not localized
export const localizeRoute = (route: string, locale: string, defaultLocale: string) =>
Expand Down
12 changes: 6 additions & 6 deletions test/__snapshots__/index.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -658,6 +658,12 @@ Array [
"status": 200,
"to": "/.netlify/builders/_ipx",
},
Object {
"force": true,
"from": "/_next/data/build-id/en.json",
"status": 200,
"to": "/.netlify/builders/___netlify-odb-handler",
},
Object {
"force": false,
"from": "/_next/data/build-id/en/500.json",
Expand Down Expand Up @@ -844,12 +850,6 @@ Array [
"status": 200,
"to": "/.netlify/functions/___netlify-handler",
},
Object {
"force": true,
"from": "/_next/data/build-id/en/index.json",
"status": 200,
"to": "/.netlify/builders/___netlify-odb-handler",
},
Object {
"force": false,
"from": "/_next/data/build-id/en/layouts.json",
Expand Down

0 comments on commit 4f6cdd9

Please sign in to comment.