Skip to content

Commit 4f6cdd9

Browse files
authored
fix: data route rewrite for i18n root route (#2002)
* fix: data route rewrite for i18n root route * chore: update snapshots for new rewrite
1 parent 92e209f commit 4f6cdd9

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

packages/runtime/src/helpers/utils.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ export const generateNetlifyRoutes = ({
7474
}) => [...(withData ? toNetlifyRoute(dataRoute) : []), ...toNetlifyRoute(route)]
7575

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

7979
// Default locale is served from root, not localized
8080
export const localizeRoute = (route: string, locale: string, defaultLocale: string) =>

test/__snapshots__/index.spec.js.snap

+6-6
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,12 @@ Array [
658658
"status": 200,
659659
"to": "/.netlify/builders/_ipx",
660660
},
661+
Object {
662+
"force": true,
663+
"from": "/_next/data/build-id/en.json",
664+
"status": 200,
665+
"to": "/.netlify/builders/___netlify-odb-handler",
666+
},
661667
Object {
662668
"force": false,
663669
"from": "/_next/data/build-id/en/500.json",
@@ -844,12 +850,6 @@ Array [
844850
"status": 200,
845851
"to": "/.netlify/functions/___netlify-handler",
846852
},
847-
Object {
848-
"force": true,
849-
"from": "/_next/data/build-id/en/index.json",
850-
"status": 200,
851-
"to": "/.netlify/builders/___netlify-odb-handler",
852-
},
853853
Object {
854854
"force": false,
855855
"from": "/_next/data/build-id/en/layouts.json",

0 commit comments

Comments
 (0)