@@ -782,10 +782,12 @@ async function generateDynamicFlightRenderResultWithStagesInDev(
782782 onFlightDataRenderError
783783 )
784784
785- // If we decide to validate this render we will assign this function when the
786- // payload is constructed.
787- let resolveValidation : null | ReturnType < typeof createValidationOutlet > [ 0 ] =
788- null
785+ // We only validate RSC requests if it is for HMR refreshes since
786+ // we know we will render all the layouts necessary to perform the validation.
787+ const shouldValidate = ! ! (
788+ ! isBypassingCachesInDev ( renderOpts , initialRequestStore ) &&
789+ initialRequestStore . isHmrRefresh
790+ )
789791
790792 const getPayload = async ( requestStore : RequestStore ) => {
791793 const payload : RSCPayload &
@@ -803,18 +805,8 @@ async function generateDynamicFlightRenderResultWithStagesInDev(
803805 payload . _bypassCachesInDev = createElement ( WarnForBypassCachesInDev , {
804806 route : workStore . route ,
805807 } )
806- } else if ( requestStore . isHmrRefresh ) {
807- // We only validate RSC requests if it is for HMR refreshes since
808- // we know we will render all the layouts necessary to perform the validation.
809- // We also must add the canonical URL part of the payload
810-
811- // Placing the validation outlet in the payload is safe
812- // even if we end up discarding a render and restarting,
813- // because we're not going to wait for the stream to complete,
814- // so leaving the validation unresolved is fine.
815- const [ validationResolver , validationOutlet ] = createValidationOutlet ( )
816- resolveValidation = validationResolver
817- payload . _validation = validationOutlet
808+ } else if ( shouldValidate ) {
809+ // If this payload will be used for validation, it needs to contain the canonical URL
818810 payload . c = prepareInitialCanonicalUrl ( url )
819811 }
820812
@@ -855,7 +847,7 @@ async function generateDynamicFlightRenderResultWithStagesInDev(
855847 onError
856848 )
857849
858- if ( resolveValidation ) {
850+ if ( shouldValidate ) {
859851 let validationDebugChannelClient : Readable | undefined = undefined
860852 if ( returnedDebugChannel ) {
861853 const [ t1 , t2 ] = returnedDebugChannel . clientSide . readable . tee ( )
@@ -3587,14 +3579,6 @@ function createDebugChannel(): DebugChannelPair | undefined {
35873579 }
35883580}
35893581
3590- function createValidationOutlet ( ) {
3591- let resolveValidation : ( value : ReactNode ) => void
3592- let outlet = new Promise < ReactNode > ( ( resolve ) => {
3593- resolveValidation = resolve
3594- } )
3595- return [ resolveValidation ! , outlet ] as const
3596- }
3597-
35983582/**
35993583 * Logs the given messages, and sends the error instances to the browser as an
36003584 * RSC stream, where they can be deserialized and logged (or otherwise presented
0 commit comments