@@ -671,8 +671,8 @@ async function generateDynamicFlightRenderResultWithCachesInDev(
671671
672672 // Before we kick off the render, we set the cache status back to it's initial state
673673 // in case a previous render bypassed the cache.
674- if ( process . env . NODE_ENV === 'development' ) {
675- setCacheStatus ! ( 'ready' , htmlRequestId , requestId )
674+ if ( process . env . NODE_ENV === 'development' && setCacheStatus ) {
675+ setCacheStatus ( 'ready' , htmlRequestId , requestId )
676676 }
677677
678678 function onFlightDataRenderError ( err : DigestedError ) {
@@ -1899,9 +1899,13 @@ async function renderToHTMLOrFlightImpl(
18991899 )
19001900 } else {
19011901 // Set cache status to bypass when specifically bypassing caches in dev
1902- if ( process . env . NODE_ENV === 'development' && bypassCachesInDev ) {
1902+ if (
1903+ process . env . NODE_ENV === 'development' &&
1904+ bypassCachesInDev &&
1905+ renderOpts . setCacheStatus
1906+ ) {
19031907 const { setCacheStatus } = renderOpts
1904- setCacheStatus ! ( 'bypass' , htmlRequestId , requestId )
1908+ setCacheStatus ( 'bypass' , htmlRequestId , requestId )
19051909 }
19061910 return generateDynamicFlightRenderResult ( req , ctx , requestStore )
19071911 }
@@ -2925,8 +2929,8 @@ async function renderWithRestartOnCacheMissInDev(
29252929 }
29262930 }
29272931
2928- if ( process . env . NODE_ENV === 'development' ) {
2929- setCacheStatus ! ( 'filling' , htmlRequestId , requestId )
2932+ if ( process . env . NODE_ENV === 'development' && setCacheStatus ) {
2933+ setCacheStatus ( 'filling' , htmlRequestId , requestId )
29302934 }
29312935
29322936 // Cache miss. We will use the initial render to fill caches, and discard its result.
@@ -2998,10 +3002,8 @@ async function renderWithRestartOnCacheMissInDev(
29983002 )
29993003 )
30003004
3001- if ( process . env . NODE_ENV === 'development' ) {
3002- // TODO: Don't know if this is the right time.
3003- // It's not wired up on the frontend though.
3004- setCacheStatus ! ( 'filled' , htmlRequestId , requestId )
3005+ if ( process . env . NODE_ENV === 'development' && setCacheStatus ) {
3006+ setCacheStatus ( 'filled' , htmlRequestId , requestId )
30053007 }
30063008
30073009 return {
0 commit comments