diff --git a/packages/next/src/server/app-render/app-render.tsx b/packages/next/src/server/app-render/app-render.tsx index ce621da2984fd..f32466cc73fab 100644 --- a/packages/next/src/server/app-render/app-render.tsx +++ b/packages/next/src/server/app-render/app-render.tsx @@ -562,7 +562,8 @@ async function generateDynamicFlightRenderResult( ctx, false, ctx.clientReferenceManifest, - ctx.workStore.route + ctx.workStore.route, + requestStore ) } @@ -1654,7 +1655,8 @@ async function renderToStream( ctx, res.statusCode === 404, clientReferenceManifest, - workStore.route + workStore.route, + requestStore ) reactServerResult = new ReactServerResult(reactServerStream) @@ -1980,7 +1982,8 @@ async function spawnDynamicValidationInDev( ctx: AppRenderContext, isNotFound: boolean, clientReferenceManifest: NonNullable, - route: string + route: string, + requestStore: RequestStore ): Promise { const { componentMod: ComponentMod } = ctx @@ -2235,6 +2238,8 @@ async function spawnDynamicValidationInDev( isPrerenderInterruptedError(err) || finalClientController.signal.aborted ) { + requestStore.usedDynamic = true + const componentStack: string | undefined = (errorInfo as any) .componentStack if (typeof componentStack === 'string') { diff --git a/test/e2e/app-dir/dynamic-io/dynamic-io.test.ts b/test/e2e/app-dir/dynamic-io/dynamic-io.test.ts index 7fdc6bd4ac773..54975a74c32e7 100644 --- a/test/e2e/app-dir/dynamic-io/dynamic-io.test.ts +++ b/test/e2e/app-dir/dynamic-io/dynamic-io.test.ts @@ -29,7 +29,7 @@ describe('dynamic-io', () => { return staticIndicatorPresent } - it('should not have static indicator on dynamic route', async () => { + it('should not have static indicator on dynamic method route', async () => { const browser = await next.browser('/cases/dynamic_api_cookies') await retry(async () => { @@ -41,6 +41,18 @@ describe('dynamic-io', () => { expect(await hasStaticIndicator(browser)).toBe(false) }) + it('should not have static indicator on dynamic IO route', async () => { + const browser = await next.browser('/cases/fetch_mixed') + + await retry(async () => { + expect(await browser.eval('!!window.next.router ? "yes": "no"')).toBe( + 'yes' + ) + }) + + expect(await hasStaticIndicator(browser)).toBe(false) + }) + it('should have static indicator on static route', async () => { const browser = await next.browser('/cases/static')