Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
use both...
  • Loading branch information
gnoff committed Jun 6, 2022
commit 3b86e0fb631f2174e1207b8c0a4cb2bd5aacb6d2
10 changes: 5 additions & 5 deletions packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ let React;
let ReactDOMClient;
let ReactDOMServer;
let act;
let __WWW__;
let usingPartialRenderer;

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

__WWW__ = global.__WWW__;
usingPartialRenderer = global.__WWW__ && !__EXPERIMENTAL__;

console.error = jest.fn();
container = document.createElement('div');
Expand Down Expand Up @@ -732,7 +732,7 @@ describe('ReactDOMServerHydration', () => {
}

// @TODO FB bundles use a different renderer that does not serialize errors to the client
const mismatchEl = __WWW__ ? '<p>' : '<template>';
const mismatchEl = usingPartialRenderer ? '<p>' : '<template>';
// @TODO changes made to sending Fizz errors to client led to the insertion of templates in client rendered
// suspense boundaries. This leaks in this test becuase the client rendered suspense boundary appears like
// unhydrated tail nodes and this template is the first match. When we add special case handling for client
Expand Down Expand Up @@ -821,7 +821,7 @@ describe('ReactDOMServerHydration', () => {
}
// We gate this assertion becuase fb-classic uses PartialRenderer for renderToString and it does not
// serialize server errors and send to client
if (__WWW__) {
if (usingPartialRenderer) {
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
Array [
"Caught [The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.]",
Expand Down Expand Up @@ -856,7 +856,7 @@ describe('ReactDOMServerHydration', () => {
}
// We gate this assertion becuase fb-classic uses PartialRenderer for renderToString and it does not
// serialize server errors and send to client
if (__WWW__) {
if (usingPartialRenderer) {
expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
Array [
"Caught [The server could not finish this Suspense boundary, likely due to an error during server rendering. Switched to client rendering.]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ let Suspense;
let SuspenseList;
let act;
let IdleEventPriority;
let __WWW__;
let usingPartialRenderer;

function normalizeCodeLocInfo(strOrErr) {
if (strOrErr && strOrErr.replace) {
Expand Down Expand Up @@ -111,7 +111,7 @@ describe('ReactDOMServerPartialHydration', () => {
SuspenseList = React.SuspenseList;
}

__WWW__ = global.__WWW__;
usingPartialRenderer = global.__WWW__ && !__EXPERIMENTAL__;

IdleEventPriority = require('react-reconciler/constants').IdleEventPriority;
});
Expand Down Expand Up @@ -1671,8 +1671,8 @@ describe('ReactDOMServerPartialHydration', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
// we exclude dev fb bundles
if (__DEV__ && !__WWW__) {
// we exclude fb bundles with partial renderer
if (__DEV__ && !usingPartialRenderer) {
expect(Scheduler).toFlushAndYield([
'This Suspense boundary was aborted by the server.',
]);
Expand Down Expand Up @@ -1739,8 +1739,8 @@ describe('ReactDOMServerPartialHydration', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
// we exclude dev fb bundles
if (__DEV__ && !__WWW__) {
// we exclude fb bundles with partial renderer
if (__DEV__ && !usingPartialRenderer) {
expect(Scheduler).toFlushAndYield([
'This Suspense boundary was aborted by the server.',
]);
Expand Down Expand Up @@ -1812,8 +1812,8 @@ describe('ReactDOMServerPartialHydration', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
// we exclude dev fb bundles
if (__DEV__ && !__WWW__) {
// we exclude fb bundles with partial renderer
if (__DEV__ && !usingPartialRenderer) {
expect(Scheduler).toFlushAndYield([
'This Suspense boundary was aborted by the server.',
]);
Expand Down Expand Up @@ -2136,8 +2136,8 @@ describe('ReactDOMServerPartialHydration', () => {
});

suspend = true;
// we exclude fb-classic as well by requiring __EXPERIMENTAL__
if (__DEV__ && __EXPERIMENTAL__) {
// we exclude fb bundles with partial renderer
if (__DEV__ && !usingPartialRenderer) {
expect(Scheduler).toFlushAndYield([
'This Suspense boundary was aborted by the server.',
]);
Expand Down Expand Up @@ -2205,8 +2205,8 @@ describe('ReactDOMServerPartialHydration', () => {
Scheduler.unstable_yieldValue(error.message);
},
});
// we exclude dev fb bundles
if (__DEV__ && !__WWW__) {
// we exclude fb bundles with partial renderer
if (__DEV__ && !usingPartialRenderer) {
expect(Scheduler).toFlushAndYield([
'This Suspense boundary was aborted by the server.',
]);
Expand Down