@@ -33,6 +33,7 @@ import {
3333  enableSuspenseLayoutEffectSemantics , 
3434  enableUseMutableSource , 
3535  enableTransitionTracing , 
36+   enableStaticFlagMissingCheck , 
3637}  from  'shared/ReactFeatureFlags' ; 
3738
3839import  { 
@@ -495,25 +496,27 @@ export function renderWithHooks<Props, SecondArg>(
495496    hookTypesDev  =  null ; 
496497    hookTypesUpdateIndexDev  =  - 1 ; 
497498
498-     // Confirm that a static flag was not added or removed since the last 
499-     // render. If this fires, it suggests that we incorrectly reset the static 
500-     // flags in some other part of the codebase. This has happened before, for 
501-     // example, in the SuspenseList implementation. 
502-     if  ( 
503-       current  !==  null  && 
504-       ( current . flags  &  StaticMaskEffect )  !== 
505-         ( workInProgress . flags  &  StaticMaskEffect )  && 
506-       // Disable this warning in legacy mode, because legacy Suspense is weird 
507-       // and creates false positives. To make this work in legacy mode, we'd 
508-       // need to mark fibers that commit in an incomplete state, somehow. For 
509-       // now I'll disable the warning that most of the bugs that would trigger 
510-       // it are either exclusive to concurrent mode or exist in both. 
511-       ( current . mode  &  ConcurrentMode )  !==  NoMode 
512-     )  { 
513-       console . error ( 
514-         'Internal React error: Expected static flag was missing. Please '  + 
515-           'notify the React team.' , 
516-       ) ; 
499+     if  ( enableStaticFlagMissingCheck )  { 
500+       // Confirm that a static flag was not added or removed since the last 
501+       // render. If this fires, it suggests that we incorrectly reset the static 
502+       // flags in some other part of the codebase. This has happened before, for 
503+       // example, in the SuspenseList implementation. 
504+       if  ( 
505+         current  !==  null  && 
506+         ( current . flags  &  StaticMaskEffect )  !== 
507+           ( workInProgress . flags  &  StaticMaskEffect )  && 
508+         // Disable this warning in legacy mode, because legacy Suspense is weird 
509+         // and creates false positives. To make this work in legacy mode, we'd 
510+         // need to mark fibers that commit in an incomplete state, somehow. For 
511+         // now I'll disable the warning that most of the bugs that would trigger 
512+         // it are either exclusive to concurrent mode or exist in both. 
513+         ( current . mode  &  ConcurrentMode )  !==  NoMode 
514+       )  { 
515+         console . error ( 
516+           'Internal React error: Expected static flag was missing. Please '  + 
517+             'notify the React team.' , 
518+         ) ; 
519+       } 
517520    } 
518521  } 
519522
0 commit comments