Unverified Commit 3cde42ff authored by Zack Tanner's avatar Zack Tanner Committed by GitHub

static indicator shouldn't show for force-dynamic (#71284)

The static indicator shouldn't show for pages that are opted into
dynamic rendering via `export const dynamic = 'force-dynamic'`.
parent df4bb11d
......@@ -921,7 +921,8 @@ async function renderToHTMLOrFlightImpl(
process.env.NODE_ENV === 'development' &&
renderOpts.setAppIsrStatus &&
!isPPR &&
!requestStore.usedDynamic
!requestStore.usedDynamic &&
!workStore.forceDynamic
) {
// only node can be ISR so we only need to update the status here
const { pathname } = new URL(req.url || '/', 'http://n')
......
import { WaitForHydration } from './wait-for-hydration'
export const dynamic = 'force-dynamic'
export default function Page() {
return <WaitForHydration />
}
'use client'
import { useEffect, useState } from 'react'
export function WaitForHydration() {
const [hydrated, setHydrated] = useState(false)
useEffect(() => {
setHydrated(true)
}, [])
if (hydrated) {
return <div id="ready">hydrated</div>
}
return null
}
......@@ -85,4 +85,12 @@ describe('prerender indicator', () => {
await next.deleteFile('app/page.tsx')
}
})
it('should not have static indicator when using force-dynamic', async () => {
const browser = await next.browser('/force-dynamic')
await browser.waitForElementByCss('#ready')
expect(await hasStaticIndicator(browser)).toBe(false)
})
})
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment