Skip to content

Commit 3b86e0f

Browse files
committed
use both...
1 parent b0837f6 commit 3b86e0f

File tree

2 files changed

+17
-17
lines changed

2 files changed

+17
-17
lines changed

packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ let React;
1111
let ReactDOMClient;
1212
let ReactDOMServer;
1313
let act;
14-
let __WWW__;
14+
let usingPartialRenderer;
1515

1616
const util = require('util');
1717
const realConsoleError = console.error;
@@ -26,7 +26,7 @@ describe('ReactDOMServerHydration', () => {
2626
ReactDOMServer = require('react-dom/server');
2727
act = require('react-dom/test-utils').act;
2828

29-
__WWW__ = global.__WWW__;
29+
usingPartialRenderer = global.__WWW__ && !__EXPERIMENTAL__;
3030

3131
console.error = jest.fn();
3232
container = document.createElement('div');
@@ -732,7 +732,7 @@ describe('ReactDOMServerHydration', () => {
732732
}
733733

734734
// @TODO FB bundles use a different renderer that does not serialize errors to the client
735-
const mismatchEl = __WWW__ ? '<p>' : '<template>';
735+
const mismatchEl = usingPartialRenderer ? '<p>' : '<template>';
736736
// @TODO changes made to sending Fizz errors to client led to the insertion of templates in client rendered
737737
// suspense boundaries. This leaks in this test becuase the client rendered suspense boundary appears like
738738
// unhydrated tail nodes and this template is the first match. When we add special case handling for client
@@ -821,7 +821,7 @@ describe('ReactDOMServerHydration', () => {
821821
}
822822
// We gate this assertion becuase fb-classic uses PartialRenderer for renderToString and it does not
823823
// serialize server errors and send to client
824-
if (__WWW__) {
824+
if (usingPartialRenderer) {
825825
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
826826
Array [
827827
"Caught [The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.]",
@@ -856,7 +856,7 @@ describe('ReactDOMServerHydration', () => {
856856
}
857857
// We gate this assertion becuase fb-classic uses PartialRenderer for renderToString and it does not
858858
// serialize server errors and send to client
859-
if (__WWW__) {
859+
if (usingPartialRenderer) {
860860
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
861861
Array [
862862
"Caught [The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.]",

packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js

+12-12
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ let Suspense;
1919
let SuspenseList;
2020
let act;
2121
let IdleEventPriority;
22-
let __WWW__;
22+
let usingPartialRenderer;
2323

2424
function normalizeCodeLocInfo(strOrErr) {
2525
if (strOrErr && strOrErr.replace) {
@@ -111,7 +111,7 @@ describe('ReactDOMServerPartialHydration', () => {
111111
SuspenseList = React.SuspenseList;
112112
}
113113

114-
__WWW__ = global.__WWW__;
114+
usingPartialRenderer = global.__WWW__ && !__EXPERIMENTAL__;
115115

116116
IdleEventPriority = require('react-reconciler/constants').IdleEventPriority;
117117
});
@@ -1671,8 +1671,8 @@ describe('ReactDOMServerPartialHydration', () => {
16711671
Scheduler.unstable_yieldValue(error.message);
16721672
},
16731673
});
1674-
// we exclude dev fb bundles
1675-
if (__DEV__ && !__WWW__) {
1674+
// we exclude fb bundles with partial renderer
1675+
if (__DEV__ && !usingPartialRenderer) {
16761676
expect(Scheduler).toFlushAndYield([
16771677
'This Suspense boundary was aborted by the server.',
16781678
]);
@@ -1739,8 +1739,8 @@ describe('ReactDOMServerPartialHydration', () => {
17391739
Scheduler.unstable_yieldValue(error.message);
17401740
},
17411741
});
1742-
// we exclude dev fb bundles
1743-
if (__DEV__ && !__WWW__) {
1742+
// we exclude fb bundles with partial renderer
1743+
if (__DEV__ && !usingPartialRenderer) {
17441744
expect(Scheduler).toFlushAndYield([
17451745
'This Suspense boundary was aborted by the server.',
17461746
]);
@@ -1812,8 +1812,8 @@ describe('ReactDOMServerPartialHydration', () => {
18121812
Scheduler.unstable_yieldValue(error.message);
18131813
},
18141814
});
1815-
// we exclude dev fb bundles
1816-
if (__DEV__ && !__WWW__) {
1815+
// we exclude fb bundles with partial renderer
1816+
if (__DEV__ && !usingPartialRenderer) {
18171817
expect(Scheduler).toFlushAndYield([
18181818
'This Suspense boundary was aborted by the server.',
18191819
]);
@@ -2136,8 +2136,8 @@ describe('ReactDOMServerPartialHydration', () => {
21362136
});
21372137

21382138
suspend = true;
2139-
// we exclude fb-classic as well by requiring __EXPERIMENTAL__
2140-
if (__DEV__ && __EXPERIMENTAL__) {
2139+
// we exclude fb bundles with partial renderer
2140+
if (__DEV__ && !usingPartialRenderer) {
21412141
expect(Scheduler).toFlushAndYield([
21422142
'This Suspense boundary was aborted by the server.',
21432143
]);
@@ -2205,8 +2205,8 @@ describe('ReactDOMServerPartialHydration', () => {
22052205
Scheduler.unstable_yieldValue(error.message);
22062206
},
22072207
});
2208-
// we exclude dev fb bundles
2209-
if (__DEV__ && !__WWW__) {
2208+
// we exclude fb bundles with partial renderer
2209+
if (__DEV__ && !usingPartialRenderer) {
22102210
expect(Scheduler).toFlushAndYield([
22112211
'This Suspense boundary was aborted by the server.',
22122212
]);

0 commit comments

Comments
 (0)