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

Fix revalidate check in client component #41917

Merged
merged 1 commit into from
Oct 27, 2022
Merged
Show file tree
Hide file tree
Changes from all 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/server/app-render.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1007,7 +1007,7 @@ export async function renderToHTMLOrFlight(
? DefaultNotFound
: undefined

if (typeof layoutOrPageMod?.revalidate !== 'undefined') {
if (typeof layoutOrPageMod?.revalidate === 'number') {
defaultRevalidate = layoutOrPageMod.revalidate

if (isStaticGeneration && defaultRevalidate === 0) {
Expand Down
45 changes: 23 additions & 22 deletions test/e2e/app-dir/app-static.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ const glob = promisify(globOrig)
describe('app-dir static/dynamic handling', () => {
const isDev = (global as any).isNextDev

if ((global as any).isNextDeploy) {
it('should skip next deploy for now', () => {})
return
}

let next: NextInstance

beforeAll(async () => {
Expand Down Expand Up @@ -392,19 +387,22 @@ describe('app-dir static/dynamic handling', () => {
)
})

it('should have values from canonical url on rewrite', async () => {
const browser = await webdriver(
next.url,
'/rewritten-use-search-params?first=a&second=b&third=c'
)
// TODO-APP: re-enable after investigating rewrite params
if (!(global as any).isNextDeploy) {
it('should have values from canonical url on rewrite', async () => {
const browser = await webdriver(
next.url,
'/rewritten-use-search-params?first=a&second=b&third=c'
)

expect(await browser.elementByCss('#params-first').text()).toBe('a')
expect(await browser.elementByCss('#params-second').text()).toBe('b')
expect(await browser.elementByCss('#params-third').text()).toBe('c')
expect(await browser.elementByCss('#params-not-real').text()).toBe(
'N/A'
)
})
expect(await browser.elementByCss('#params-first').text()).toBe('a')
expect(await browser.elementByCss('#params-second').text()).toBe('b')
expect(await browser.elementByCss('#params-third').text()).toBe('c')
expect(await browser.elementByCss('#params-not-real').text()).toBe(
'N/A'
)
})
}
})

describe('usePathname', () => {
Expand Down Expand Up @@ -432,10 +430,13 @@ describe('app-dir static/dynamic handling', () => {
)
})
})
it('should show a message to leave feedback for `appDir`', async () => {
expect(next.cliOutput).toContain(
`Thank you for testing \`appDir\` please leave your feedback at https://nextjs.link/app-feedback`
)
})

if (!(global as any).isNextDeploy) {
it('should show a message to leave feedback for `appDir`', async () => {
expect(next.cliOutput).toContain(
`Thank you for testing \`appDir\` please leave your feedback at https://nextjs.link/app-feedback`
)
})
}
})
})
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import Link from 'next/link'

export default function Page({ params }) {
Expand Down