89
if (gate(flags => flags.favorSafetyOverHydrationPerf)) {
90
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
91
[
92
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
92
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
93
94
- A server/client branch \`if (typeof window !== 'undefined')\`.
153
if (gate(flags => flags.favorSafetyOverHydrationPerf)) {
154
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
155
[
157
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
156
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
157
158
- A server/client branch \`if (typeof window !== 'undefined')\`.
461
}
462
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
463
[
466
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
464
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
465
466
- A server/client branch \`if (typeof window !== 'undefined')\`.
495
}
496
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
497
[
501
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
498
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
499
500
- A server/client branch \`if (typeof window !== 'undefined')\`.
531
}
532
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
533
[
538
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
534
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
535
536
- A server/client branch \`if (typeof window !== 'undefined')\`.
568
}
569
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
570
[
576
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
571
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
572
573
- A server/client branch \`if (typeof window !== 'undefined')\`.
600
}
601
if (gate(flags => flags.favorSafetyOverHydrationPerf)) {
602
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
609
- [
610
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
611
- "Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
612
-
613
- - A server/client branch \`if (typeof window !== 'undefined')\`.
614
- - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
615
- - Date formatting in a user's locale which doesn't match the server.
616
- - External changing data without sending a snapshot of it along with the HTML.
617
- - Invalid HTML tag nesting.
618
-
619
- It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
620
-
621
- https://react.dev/link/hydration-mismatch
622
-
623
- <Mismatch isClient={true}>
624
- <div className="parent">
625
- + only
626
- -
627
- ]",
628
- "Caught [There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.]",
629
- ]
630
- `);
603
+ [
604
+ "Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
605
+
606
+ - A server/client branch \`if (typeof window !== 'undefined')\`.
607
+ - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
608
+ - Date formatting in a user's locale which doesn't match the server.
609
+ - External changing data without sending a snapshot of it along with the HTML.
610
+ - Invalid HTML tag nesting.
611
+
612
+ It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
613
+
614
+ https://react.dev/link/hydration-mismatch
615
+
616
+ <Mismatch isClient={true}>
617
+ <div className="parent">
618
+ + only
619
+ -
620
+ ]",
621
+ "Caught [There was an error while hydrating. Because the error happened outside of a Suspense boundary, the entire root will switch to client rendering.]",
622
+ ]
623
+ `);
624
} else {
625
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
626
[
659
}
660
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
661
[
669
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
662
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
663
664
- A server/client branch \`if (typeof window !== 'undefined')\`.
696
}
697
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
698
[
707
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
699
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
700
701
- A server/client branch \`if (typeof window !== 'undefined')\`.
732
}
733
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
734
[
744
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
735
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
736
737
- A server/client branch \`if (typeof window !== 'undefined')\`.
770
}
771
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
772
[
783
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
773
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
774
775
- A server/client branch \`if (typeof window !== 'undefined')\`.
804
}
805
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
806
[
818
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
807
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
808
809
- A server/client branch \`if (typeof window !== 'undefined')\`.
840
}
841
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
842
[
855
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
843
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
844
845
- A server/client branch \`if (typeof window !== 'undefined')\`.
876
}
877
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
878
[
892
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
879
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
880
881
- A server/client branch \`if (typeof window !== 'undefined')\`.
906
}
907
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
908
[
923
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
909
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
910
911
- A server/client branch \`if (typeof window !== 'undefined')\`.
940
}
941
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
942
[
958
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
943
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
944
945
- A server/client branch \`if (typeof window !== 'undefined')\`.
976
}
977
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
978
[
995
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
979
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
980
981
- A server/client branch \`if (typeof window !== 'undefined')\`.
1012
}
1013
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
1014
[
1032
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
1015
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
1016
1017
- A server/client branch \`if (typeof window !== 'undefined')\`.
1056
}
1057
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
1058
[
1077
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
1059
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
1060
1061
- A server/client branch \`if (typeof window !== 'undefined')\`.
1092
}
1093
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
1094
[
1114
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
1095
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
1096
1097
- A server/client branch \`if (typeof window !== 'undefined')\`.
1130
// TODO: This message doesn't seem to have any useful details.
1131
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
1132
[
1153
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
1133
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
1134
1135
- A server/client branch \`if (typeof window !== 'undefined')\`.
1172
// rendered suspense boundaries this test will likely change again
1173
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
1174
[
1196
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
1175
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
1176
1177
- A server/client branch \`if (typeof window !== 'undefined')\`.
1343
}
1344
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
1345
[
1368
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
1346
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
1347
1348
- A server/client branch \`if (typeof window !== 'undefined')\`.
1382
}
1383
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
1384
[
1408
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
1385
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
1386
1387
- A server/client branch \`if (typeof window !== 'undefined')\`.
1444
1445
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
1446
[
1471
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
1447
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
1448
1449
- A server/client branch \`if (typeof window !== 'undefined')\`.
1506
1507
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
1508
[
1534
- "Warning: An error occurred during hydration. The server HTML was replaced with client content.",
1509
"Caught [Hydration failed because the server rendered HTML didn't match the client. As a result this tree will be regenerated on the client. This can happen if a SSR-ed Client Component used:
1510
1511
- A server/client branch \`if (typeof window !== 'undefined')\`.