@@ -62,6 +62,7 @@ import dangerousStyleValue from '../shared/dangerousStyleValue';
6262import { retryIfBlockedOn } from '../events/ReactDOMEventReplaying' ;
6363
6464import {
65+ enableClientRenderFallbackOnHydrationMismatch ,
6566 enableSuspenseServerRenderer ,
6667 enableCreateEventHandleAPI ,
6768 enableScopeAPI ,
@@ -1004,14 +1005,20 @@ export function didNotHydrateInstance(
10041005 parentProps : Props ,
10051006 parentInstance : Instance ,
10061007 instance : HydratableInstance ,
1008+ isConcurrentMode : boolean ,
10071009) {
1008- if ( __DEV__ && parentProps [ SUPPRESS_HYDRATION_WARNING ] !== true ) {
1009- if ( instance . nodeType === ELEMENT_NODE ) {
1010- warnForDeletedHydratableElement ( parentInstance , ( instance : any ) ) ;
1011- } else if ( instance . nodeType === COMMENT_NODE ) {
1012- // TODO: warnForDeletedHydratableSuspenseBoundary
1013- } else {
1014- warnForDeletedHydratableText ( parentInstance , ( instance : any ) ) ;
1010+ if ( __DEV__ ) {
1011+ if (
1012+ ( enableClientRenderFallbackOnHydrationMismatch && isConcurrentMode ) ||
1013+ parentProps [ SUPPRESS_HYDRATION_WARNING ] !== true
1014+ ) {
1015+ if ( instance . nodeType === ELEMENT_NODE ) {
1016+ warnForDeletedHydratableElement ( parentInstance , ( instance : any ) ) ;
1017+ } else if ( instance . nodeType === COMMENT_NODE ) {
1018+ // TODO: warnForDeletedHydratableSuspenseBoundary
1019+ } else {
1020+ warnForDeletedHydratableText ( parentInstance , ( instance : any ) ) ;
1021+ }
10151022 }
10161023 }
10171024}
@@ -1082,9 +1089,15 @@ export function didNotFindHydratableInstance(
10821089 parentInstance : Instance ,
10831090 type : string ,
10841091 props : Props ,
1092+ isConcurrentMode : boolean ,
10851093) {
1086- if ( __DEV__ && parentProps [ SUPPRESS_HYDRATION_WARNING ] !== true ) {
1087- warnForInsertedHydratedElement ( parentInstance , type , props ) ;
1094+ if ( __DEV__ ) {
1095+ if (
1096+ ( enableClientRenderFallbackOnHydrationMismatch && isConcurrentMode ) ||
1097+ parentProps [ SUPPRESS_HYDRATION_WARNING ] !== true
1098+ ) {
1099+ warnForInsertedHydratedElement ( parentInstance , type , props ) ;
1100+ }
10881101 }
10891102}
10901103
@@ -1093,9 +1106,15 @@ export function didNotFindHydratableTextInstance(
10931106 parentProps : Props ,
10941107 parentInstance : Instance ,
10951108 text : string ,
1109+ isConcurrentMode : boolean ,
10961110) {
1097- if ( __DEV__ && parentProps [ SUPPRESS_HYDRATION_WARNING ] !== true ) {
1098- warnForInsertedHydratedText ( parentInstance , text ) ;
1111+ if ( __DEV__ ) {
1112+ if (
1113+ ( enableClientRenderFallbackOnHydrationMismatch && isConcurrentMode ) ||
1114+ parentProps [ SUPPRESS_HYDRATION_WARNING ] !== true
1115+ ) {
1116+ warnForInsertedHydratedText ( parentInstance , text ) ;
1117+ }
10991118 }
11001119}
11011120
@@ -1104,7 +1123,7 @@ export function didNotFindHydratableSuspenseInstance(
11041123 parentProps : Props ,
11051124 parentInstance : Instance ,
11061125) {
1107- if ( __DEV__ && parentProps [ SUPPRESS_HYDRATION_WARNING ] !== true ) {
1126+ if ( __DEV__ ) {
11081127 // TODO: warnForInsertedHydratedSuspense(parentInstance);
11091128 }
11101129}
0 commit comments