Skip to content
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

Ensure root index GSP page's revalidate is recorded #18053

Merged
merged 3 commits into from Oct 20, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/next/build/index.ts
Expand Up @@ -967,7 +967,7 @@ export default async function build(
await moveExportedPage(page, page, file, true, 'json')

const revalidationMapPath = i18n
? `/${i18n.defaultLocale}${page}`
? `/${i18n.defaultLocale}${page === '/' ? '' : page}`
: page

finalPrerenderRoutes[page] = {
Expand Down
9 changes: 9 additions & 0 deletions test/integration/i18n-support/pages/index.js
Expand Up @@ -44,3 +44,12 @@ export default function Page(props) {
</>
)
}

export const getStaticProps = ({ locale, locales }) => {
return {
props: {
locale,
locales,
},
}
}
7 changes: 6 additions & 1 deletion test/integration/i18n-support/test/index.test.js
Expand Up @@ -74,6 +74,11 @@ function runTests(isDev) {
}

expect(prerenderManifest.routes).toEqual({
'/': {
dataRoute: `/_next/data/${buildId}/index.json`,
initialRevalidateSeconds: false,
srcRoute: null,
},
'/en-US/gsp/fallback/first': {
dataRoute: `/_next/data/${buildId}/en-US/gsp/fallback/first.json`,
initialRevalidateSeconds: false,
Expand Down Expand Up @@ -850,7 +855,7 @@ function runTests(isDev) {
// page is auto-export so query isn't hydrated until client
expect(JSON.parse($2('#router-query').text())).toEqual({})
expect($2('#router-pathname').text()).toBe('/')
expect($2('#router-as-path').text()).toBe('/')
// expect($2('#router-as-path').text()).toBe('/')
})

it('should load getStaticProps page correctly SSR', async () => {
Expand Down