@samitouri / QOS-React-2 / commits / e43986f1f3

Finally remove favorSafetyOverHydrationPerf (#33619)

This is rolled out to 100%. Let me merge it though.

Ricky committed Jul 7, 2025 at 13:57 UTC e43986f1f3e6e94f7eef86fb21c830959e0ade6c
17 files changed +35 -373
packages/react-dom/src/__tests__/ReactDOMFizzServer-test.js
+13 -71
@@ -4656,7 +4656,6 @@ describe('ReactDOMFizzServer', () => {
4656 );
4657 });
4658
4659 - // @gate favorSafetyOverHydrationPerf
4659 it('#24384: Suspending should halt hydration warnings but still emit hydration warnings after unsuspending if mismatches are genuine', async () => {
4660 const makeApp = () => {
4661 let resolve, resolved;
@@ -4740,7 +4739,6 @@ describe('ReactDOMFizzServer', () => {
4739 await waitForAll([]);
4740 });
4741
4743 - // @gate favorSafetyOverHydrationPerf
4742 it('only warns once on hydration mismatch while within a suspense boundary', async () => {
4743 const App = ({text}) => {
4744 return (
@@ -10248,75 +10246,19 @@ describe('ReactDOMFizzServer', () => {
10246 },
10247 });
10248 await waitForAll([]);
10251 - if (gate(flags => flags.favorSafetyOverHydrationPerf)) {
10252 - expect(getVisibleChildren(document)).toEqual(
10253 - <html data-y="client">
10254 - <head data-y="client">
10255 - <meta itemprop="" name="client" />
10256 - </head>
10257 - <body data-y="client">client</body>
10258 - </html>,
10259 - );
10260 - expect(recoverableErrors).toEqual([
10261 - expect.stringContaining(
10262 - "Hydration failed because the server rendered text didn't match the client.",
10263 - ),
10264 - ]);
10265 - } else {
10266 - expect(getVisibleChildren(document)).toEqual(
10267 - <html data-x="server">
10268 - <head data-x="server">
10269 - <meta itemprop="" content="server" />
10270 - </head>
10271 - <body data-x="server">server</body>
10272 - </html>,
10273 - );
10274 - expect(recoverableErrors).toEqual([]);
10275 - assertConsoleErrorDev([
10276 - "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:" +
10277 - '\n' +
10278 - "\n- A server/client branch `if (typeof window !== 'undefined')`." +
10279 - "\n- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called." +
10280 - "\n- Date formatting in a user's locale which doesn't match the server." +
10281 - '\n- External changing data without sending a snapshot of it along with the HTML.' +
10282 - '\n- Invalid HTML tag nesting.' +
10283 - '\n' +
10284 - '\nIt can also happen if the client has a browser extension installed which messes with the HTML before React loaded.' +
10285 - '\n' +
10286 - '\nhttps://react.dev/link/hydration-mismatch' +
10287 - '\n' +
10288 - '\n <ClientApp>' +
10289 - '\n <Suspense>' +
10290 - '\n <html' +
10291 - '\n+ data-y="client"' +
10292 - '\n- data-y={null}' +
10293 - '\n- data-x="server"' +
10294 - '\n >' +
10295 - '\n <head' +
10296 - '\n+ data-y="client"' +
10297 - '\n- data-y={null}' +
10298 - '\n- data-x="server"' +
10299 - '\n >' +
10300 - '\n <meta' +
10301 - '\n itemProp=""' +
10302 - '\n+ name="client"' +
10303 - '\n- name={null}' +
10304 - '\n- content="server"' +
10305 - '\n >' +
10306 - '\n <body' +
10307 - '\n+ data-y="client"' +
10308 - '\n- data-y={null}' +
10309 - '\n- data-x="server"' +
10310 - '\n >' +
10311 - '\n+ client' +
10312 - '\n- server' +
10313 - '\n+ client' +
10314 - '\n- server' +
10315 - '\n' +
10316 - '\n in meta (at **)' +
10317 - '\n in ClientApp (at **)',
10318 - ]);
10319 - }
10249 + expect(getVisibleChildren(document)).toEqual(
10250 + <html data-y="client">
10251 + <head data-y="client">
10252 + <meta itemprop="" name="client" />
10253 + </head>
10254 + <body data-y="client">client</body>
10255 + </html>,
10256 + );
10257 + expect(recoverableErrors).toEqual([
10258 + expect.stringContaining(
10259 + "Hydration failed because the server rendered text didn't match the client.",
10260 + ),
10261 + ]);
10262
10263 root.unmount();
10264 expect(getVisibleChildren(document)).toEqual(
packages/react-dom/src/__tests__/ReactDOMFloat-test.js
-2
@@ -7391,7 +7391,6 @@ body {
7391 );
7392 });
7393
7394 - // @gate favorSafetyOverHydrationPerf
7394 it('retains styles even when a new html, head, and/body mount', async () => {
7395 await act(() => {
7396 const {pipe} = renderToPipeableStream(
@@ -9358,7 +9357,6 @@ background-color: green;
9357 ]);
9358 });
9359
9361 - // @gate favorSafetyOverHydrationPerf
9360 it('can render a title before a singleton even if that singleton clears its contents', async () => {
9361 await act(() => {
9362 const {pipe} = renderToPipeableStream(
packages/react-dom/src/__tests__/ReactDOMHydrationDiff-test.js
+3 -85
@@ -124,8 +124,7 @@ describe('ReactDOMServerHydration', () => {
124 </div>
125 );
126 }
127 - if (gate(flags => flags.favorSafetyOverHydrationPerf)) {
128 - expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
127 + expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
128 [
129 "Caught [Hydration failed because the server rendered text 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:
130
@@ -150,33 +149,6 @@ describe('ReactDOMServerHydration', () => {
149 in Mismatch (at **)",
150 ]
151 `);
153 - } else {
154 - expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
155 - [
156 - "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
157 -
158 - - A server/client branch \`if (typeof window !== 'undefined')\`.
159 - - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
160 - - Date formatting in a user's locale which doesn't match the server.
161 - - External changing data without sending a snapshot of it along with the HTML.
162 - - Invalid HTML tag nesting.
163 -
164 - It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
165 -
166 - https://react.dev/link/hydration-mismatch
167 -
168 - <Mismatch isClient={true}>
169 - <div className="parent">
170 - <main className="child">
171 - + client
172 - - server
173 -
174 - Owner Stack:
175 - in main (at **)
176 - in Mismatch (at **)",
177 - ]
178 - `);
179 - }
152 });
153
154 // @gate __DEV__
@@ -193,8 +165,7 @@ describe('ReactDOMServerHydration', () => {
165 }
166
167 /* eslint-disable no-irregular-whitespace */
196 - if (gate(flags => flags.favorSafetyOverHydrationPerf)) {
197 - expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
168 + expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
169 [
170 "Caught [Hydration failed because the server rendered text 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:
171
@@ -218,32 +189,6 @@ describe('ReactDOMServerHydration', () => {
189 in Mismatch (at **)",
190 ]
191 `);
221 - } else {
222 - expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
223 - [
224 - "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
225 -
226 - - A server/client branch \`if (typeof window !== 'undefined')\`.
227 - - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
228 - - Date formatting in a user's locale which doesn't match the server.
229 - - External changing data without sending a snapshot of it along with the HTML.
230 - - Invalid HTML tag nesting.
231 -
232 - It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
233 -
234 - https://react.dev/link/hydration-mismatch
235 -
236 - <Mismatch isClient={true}>
237 - <div>
238 - + This markup contains an nbsp entity:   client text
239 - - This markup contains an nbsp entity:   server text
240 -
241 - Owner Stack:
242 - in div (at **)
243 - in Mismatch (at **)",
244 - ]
245 - `);
246 - }
192 /* eslint-enable no-irregular-whitespace */
193 });
194
@@ -740,8 +685,7 @@ describe('ReactDOMServerHydration', () => {
685 function Mismatch({isClient}) {
686 return <div className="parent">{isClient && 'only'}</div>;
687 }
743 - if (gate(flags => flags.favorSafetyOverHydrationPerf)) {
744 - expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
688 + expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
689 [
690 "Caught [Hydration failed because the server rendered text 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:
691
@@ -765,32 +709,6 @@ describe('ReactDOMServerHydration', () => {
709 in Mismatch (at **)",
710 ]
711 `);
768 - } else {
769 - expect(testMismatch(Mismatch)).toMatchInlineSnapshot(`
770 - [
771 - "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
772 -
773 - - A server/client branch \`if (typeof window !== 'undefined')\`.
774 - - Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
775 - - Date formatting in a user's locale which doesn't match the server.
776 - - External changing data without sending a snapshot of it along with the HTML.
777 - - Invalid HTML tag nesting.
778 -
779 - It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
780 -
781 - https://react.dev/link/hydration-mismatch
782 -
783 - <Mismatch isClient={true}>
784 - <div className="parent">
785 - + only
786 - -
787 -
788 - Owner Stack:
789 - in div (at **)
790 - in Mismatch (at **)",
791 - ]
792 - `);
793 - }
712 });
713
714 // @gate __DEV__
packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js
-2
@@ -3913,7 +3913,6 @@ describe('ReactDOMServerPartialHydration', () => {
3913 );
3914 });
3915
3916 - // @gate favorSafetyOverHydrationPerf
3916 it("falls back to client rendering when there's a text mismatch (direct text child)", async () => {
3917 function DirectTextChild({text}) {
3918 return <div>{text}</div>;
@@ -3937,7 +3936,6 @@ describe('ReactDOMServerPartialHydration', () => {
3936 ]);
3937 });
3938
3940 - // @gate favorSafetyOverHydrationPerf
3939 it("falls back to client rendering when there's a text mismatch (text child with siblings)", async () => {
3940 function Sibling() {
3941 return 'Sibling';
packages/react-dom/src/__tests__/ReactDOMUseId-test.js
+8 -62
@@ -24,7 +24,6 @@ let hasErrored = false;
24 let fatalError = undefined;
25 let waitForPaint;
26 let SuspenseList;
27 -let assertConsoleErrorDev;
27
28 describe('useId', () => {
29 beforeEach(() => {
@@ -33,8 +32,6 @@ describe('useId', () => {
32 React = require('react');
33 ReactDOMClient = require('react-dom/client');
34 clientAct = require('internal-test-utils').act;
36 - assertConsoleErrorDev =
37 - require('internal-test-utils').assertConsoleErrorDev;
35 ReactDOMFizzServer = require('react-dom/server');
36 Stream = require('stream');
37 Suspense = React.Suspense;
@@ -667,82 +664,31 @@ describe('useId', () => {
664 </div>
665 `);
666
670 - if (gate(flags => flags.favorSafetyOverHydrationPerf)) {
671 - // TODO: This is a bug with revealOrder="backwards" in that it hydrates in reverse.
672 - await expect(async () => {
673 - await clientAct(async () => {
674 - ReactDOMClient.hydrateRoot(container, <Foo />);
675 - });
676 - }).rejects.toThrowError(
677 - `Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client.`,
678 - );
679 -
680 - expect(container).toMatchInlineSnapshot(`
681 - <div
682 - id="container"
683 - >
684 - <span
685 - id="_r_1_"
686 - >
687 - A
688 - </span>
689 - <span
690 - id="_r_0_"
691 - >
692 - B
693 - </span>
694 - </div>
695 - `);
696 - } else {
667 + // TODO: This is a bug with revealOrder="backwards" in that it hydrates in reverse.
668 + await expect(async () => {
669 await clientAct(async () => {
670 ReactDOMClient.hydrateRoot(container, <Foo />);
671 });
672 + }).rejects.toThrowError(
673 + `Hydration failed because the server rendered text didn't match the client. As a result this tree will be regenerated on the client.`,
674 + );
675
701 - // TODO: This is a bug with revealOrder="backwards" in that it hydrates in reverse.
702 - assertConsoleErrorDev([
703 - `A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. This won't be patched up. This can happen if a SSR-ed Client Component used:
704 -
705 -- A server/client branch \`if (typeof window !== 'undefined')\`.
706 -- Variable input such as \`Date.now()\` or \`Math.random()\` which changes each time it's called.
707 -- Date formatting in a user's locale which doesn't match the server.
708 -- External changing data without sending a snapshot of it along with the HTML.
709 -- Invalid HTML tag nesting.
710 -
711 -It can also happen if the client has a browser extension installed which messes with the HTML before React loaded.
712 -
713 -https://react.dev/link/hydration-mismatch
714 -
715 - <Foo>
716 - <SuspenseList revealOrder="unstable_l..." tail="visible">
717 - <Bar>
718 - <Bar>
719 - <Baz id="_R_2_">
720 - <span
721 -+ id="_R_2_"
722 -- id="_R_1_"
723 - >
724 -+ B
725 -- A
726 -`,
727 - ]);
728 -
729 - expect(container).toMatchInlineSnapshot(`
676 + expect(container).toMatchInlineSnapshot(`
677 <div
678 id="container"
679 >
680 <span
734 - id="_R_1_"
681 + id="_r_1_"
682 >
683 A
684 </span>
685 <span
739 - id="_R_2_"
686 + id="_r_0_"
687 >
688 B
689 </span>
690 </div>
691 `);
745 - }
692 });
693
694 it('basic incremental hydration', async () => {
packages/react-dom/src/__tests__/ReactRenderDocument-test.js
+4 -44
@@ -16,7 +16,6 @@ let ReactDOMServer;
16 let act;
17 let Scheduler;
18 let assertLog;
19 -let assertConsoleErrorDev;
19
20 function getTestDocument(markup) {
21 const doc = document.implementation.createHTMLDocument('');
@@ -49,8 +48,6 @@ describe('rendering React components at document', () => {
48 act = require('internal-test-utils').act;
49 assertLog = require('internal-test-utils').assertLog;
50 Scheduler = require('scheduler');
52 - assertConsoleErrorDev =
53 - require('internal-test-utils').assertConsoleErrorDev;
51 });
52
53 describe('with new explicit hydration API', () => {
@@ -270,9 +267,6 @@ describe('rendering React components at document', () => {
267 );
268 const testDocument = getTestDocument(markup);
269
273 - const favorSafetyOverHydrationPerf = gate(
274 - flags => flags.favorSafetyOverHydrationPerf,
275 - );
270 ReactDOM.flushSync(() => {
271 ReactDOMClient.hydrateRoot(
272 testDocument,
@@ -289,45 +283,11 @@ describe('rendering React components at document', () => {
283 },
284 );
285 });
292 - assertConsoleErrorDev(
293 - favorSafetyOverHydrationPerf
294 - ? []
295 - : [
296 - "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. " +
297 - "This won't be patched up. This can happen if a SSR-ed Client Component used:\n" +
298 - '\n' +
299 - "- A server/client branch `if (typeof window !== 'undefined')`.\n" +
300 - "- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.\n" +
301 - "- Date formatting in a user's locale which doesn't match the server.\n" +
302 - '- External changing data without sending a snapshot of it along with the HTML.\n' +
303 - '- Invalid HTML tag nesting.\n\nIt can also happen if the client has a browser extension ' +
304 - 'installed which messes with the HTML before React loaded.\n' +
305 - '\n' +
306 - 'https://react.dev/link/hydration-mismatch\n' +
307 - '\n' +
308 - ' <Component text="Hello world">\n' +
309 - ' <html>\n' +
310 - ' <head>\n' +
311 - ' <body>\n' +
312 - '+ Hello world\n' +
313 - '- Goodbye world\n' +
314 - '+ Hello world\n' +
315 - '- Goodbye world\n' +
316 - '\n in body (at **)' +
317 - '\n in Component (at **)',
318 - ],
319 - );
286
321 - assertLog(
322 - favorSafetyOverHydrationPerf
323 - ? [
324 - "onRecoverableError: Hydration failed because the server rendered text didn't match the client.",
325 - ]
326 - : [],
327 - );
328 - expect(testDocument.body.innerHTML).toBe(
329 - favorSafetyOverHydrationPerf ? 'Hello world' : 'Goodbye world',
330 - );
287 + assertLog([
288 + "onRecoverableError: Hydration failed because the server rendered text didn't match the client.",
289 + ]);
290 + expect(testDocument.body.innerHTML).toBe('Hello world');
291 });
292
293 it('should render w/ no markup to full document', async () => {
packages/react-dom/src/__tests__/ReactServerRenderingHydration-test.js
+3 -88
@@ -127,9 +127,6 @@ describe('ReactDOMServerHydration', () => {
127 // Now simulate a situation where the app is not idempotent. React should
128 // warn but do the right thing.
129 element.innerHTML = lastMarkup;
130 - const favorSafetyOverHydrationPerf = gate(
131 - flags => flags.favorSafetyOverHydrationPerf,
132 - );
130 root = await act(() => {
131 return ReactDOMClient.hydrateRoot(
132 element,
@@ -144,37 +141,10 @@ describe('ReactDOMServerHydration', () => {
141 },
142 );
143 });
147 - assertConsoleErrorDev(
148 - favorSafetyOverHydrationPerf
149 - ? []
150 - : [
151 - "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. " +
152 - "This won't be patched up. This can happen if a SSR-ed Client Component used:\n" +
153 - '\n' +
154 - "- A server/client branch `if (typeof window !== 'undefined')`.\n" +
155 - "- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.\n" +
156 - "- Date formatting in a user's locale which doesn't match the server.\n" +
157 - '- External changing data without sending a snapshot of it along with the HTML.\n' +
158 - '- Invalid HTML tag nesting.\n\nIt can also happen if the client has a browser extension ' +
159 - 'installed which messes with the HTML before React loaded.\n' +
160 - '\n' +
161 - 'https://react.dev/link/hydration-mismatch\n' +
162 - '\n' +
163 - ' <TestComponent name="y" ref={function ref}>\n' +
164 - ' <span ref={{current:null}} onClick={function}>\n' +
165 - '+ y\n' +
166 - '- x\n' +
167 - '\n in span (at **)' +
168 - '\n in TestComponent (at **)',
169 - ],
170 - );
144 +
145 expect(mountCount).toEqual(4);
146 expect(element.innerHTML.length > 0).toBe(true);
173 - if (favorSafetyOverHydrationPerf) {
174 - expect(element.innerHTML).not.toEqual(lastMarkup);
175 - } else {
176 - expect(element.innerHTML).toEqual(lastMarkup);
177 - }
147 + expect(element.innerHTML).not.toEqual(lastMarkup);
148
149 // Ensure the events system works after markup mismatch.
150 expect(numClicks).toEqual(1);
@@ -240,9 +210,6 @@ describe('ReactDOMServerHydration', () => {
210 const onFocusAfterHydration = jest.fn();
211 element.firstChild.focus = onFocusBeforeHydration;
212
243 - const favorSafetyOverHydrationPerf = gate(
244 - flags => flags.favorSafetyOverHydrationPerf,
245 - );
213 await act(() => {
214 ReactDOMClient.hydrateRoot(
215 element,
@@ -252,28 +219,6 @@ describe('ReactDOMServerHydration', () => {
219 {onRecoverableError: error => {}},
220 );
221 });
255 - assertConsoleErrorDev(
256 - favorSafetyOverHydrationPerf
257 - ? []
258 - : [
259 - "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. " +
260 - "This won't be patched up. This can happen if a SSR-ed Client Component used:\n" +
261 - '\n' +
262 - "- A server/client branch `if (typeof window !== 'undefined')`.\n" +
263 - "- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.\n" +
264 - "- Date formatting in a user's locale which doesn't match the server.\n" +
265 - '- External changing data without sending a snapshot of it along with the HTML.\n' +
266 - '- Invalid HTML tag nesting.\n\nIt can also happen if the client has a browser extension ' +
267 - 'installed which messes with the HTML before React loaded.\n' +
268 - '\n' +
269 - 'https://react.dev/link/hydration-mismatch\n' +
270 - '\n' +
271 - ' <button autoFocus={false} onFocus={function mockConstructor}>\n' +
272 - '+ client\n' +
273 - '- server\n' +
274 - '\n in button (at **)',
275 - ],
276 - );
222
223 expect(onFocusBeforeHydration).not.toHaveBeenCalled();
224 expect(onFocusAfterHydration).not.toHaveBeenCalled();
@@ -618,9 +563,6 @@ describe('ReactDOMServerHydration', () => {
563 );
564 domElement.innerHTML = markup;
565
621 - const favorSafetyOverHydrationPerf = gate(
622 - flags => flags.favorSafetyOverHydrationPerf,
623 - );
566 await act(() => {
567 ReactDOMClient.hydrateRoot(
568 domElement,
@@ -630,35 +572,8 @@ describe('ReactDOMServerHydration', () => {
572 {onRecoverableError: error => {}},
573 );
574 });
633 - assertConsoleErrorDev(
634 - favorSafetyOverHydrationPerf
635 - ? []
636 - : [
637 - "A tree hydrated but some attributes of the server rendered HTML didn't match the client properties. " +
638 - "This won't be patched up. This can happen if a SSR-ed Client Component used:\n" +
639 - '\n' +
640 - "- A server/client branch `if (typeof window !== 'undefined')`.\n" +
641 - "- Variable input such as `Date.now()` or `Math.random()` which changes each time it's called.\n" +
642 - "- Date formatting in a user's locale which doesn't match the server.\n" +
643 - '- External changing data without sending a snapshot of it along with the HTML.\n' +
644 - '- Invalid HTML tag nesting.\n\nIt can also happen if the client has a browser extension ' +
645 - 'installed which messes with the HTML before React loaded.\n' +
646 - '\n' +
647 - 'https://react.dev/link/hydration-mismatch\n' +
648 - '\n' +
649 - ' <div dangerouslySetInnerHTML={undefined}>\n' +
650 - ' <p>\n' +
651 - '+ client\n' +
652 - '- server\n' +
653 - '\n in p (at **)',
654 - ],
655 - );
575
657 - if (favorSafetyOverHydrationPerf) {
658 - expect(domElement.innerHTML).not.toEqual(markup);
659 - } else {
660 - expect(domElement.innerHTML).toEqual(markup);
661 - }
576 + expect(domElement.innerHTML).not.toEqual(markup);
577 });
578
579 it('should warn if innerHTML mismatches with dangerouslySetInnerHTML=undefined on the client', async () => {
packages/react-dom/src/__tests__/utils/ReactDOMServerIntegrationTestUtils.js
+2 -6
@@ -17,12 +17,10 @@ module.exports = function (initModules) {
17 let ReactDOMClient;
18 let ReactDOMServer;
19 let act;
20 - let ReactFeatureFlags;
20
21 function resetModules() {
22 ({ReactDOM, ReactDOMClient, ReactDOMServer} = initModules());
23 act = require('internal-test-utils').act;
25 - ReactFeatureFlags = require('shared/ReactFeatureFlags');
24 }
25
26 function shouldUseDocument(reactElement) {
@@ -274,10 +272,8 @@ module.exports = function (initModules) {
272 const cleanTextContent =
273 (cleanContainer.lastChild && cleanContainer.lastChild.textContent) || '';
274
277 - if (ReactFeatureFlags.favorSafetyOverHydrationPerf) {
278 - // The only guarantee is that text content has been patched up if needed.
279 - expect(hydratedTextContent).toBe(cleanTextContent);
280 - }
275 + // The only guarantee is that text content has been patched up if needed.
276 + expect(hydratedTextContent).toBe(cleanTextContent);
277
278 // Abort any further expects. All bets are off at this point.
279 throw new BadMarkupExpected();
packages/react-reconciler/src/ReactFiberHydrationContext.js
+2 -3
@@ -30,7 +30,6 @@ import {
30 SuspenseComponent,
31 ActivityComponent,
32 } from './ReactWorkTags';
33 -import {favorSafetyOverHydrationPerf} from 'shared/ReactFeatureFlags';
33
34 import {createCapturedValueAtFiber} from './ReactCapturedValue';
35
@@ -558,7 +557,7 @@ function prepareToHydrateHostInstance(
557 hostContext,
558 fiber,
559 );
561 - if (!didHydrate && favorSafetyOverHydrationPerf) {
560 + if (!didHydrate) {
561 throwOnHydrationMismatch(fiber, true);
562 }
563 }
@@ -624,7 +623,7 @@ function prepareToHydrateHostTextInstance(fiber: Fiber): void {
623 fiber,
624 parentProps,
625 );
627 - if (!didHydrate && favorSafetyOverHydrationPerf) {
626 + if (!didHydrate) {
627 throwOnHydrationMismatch(fiber, true);
628 }
629 }
packages/shared/ReactFeatureFlags.js
-3
@@ -31,9 +31,6 @@ export const enableHydrationLaneScheduling = true;
31 // like migrating internal callers or performance testing.
32 // -----------------------------------------------------------------------------
33
34 -// TODO: Finish rolling out in www
35 -export const favorSafetyOverHydrationPerf = true;
36 -
34 // Need to remove didTimeout argument from Scheduler before landing
35 export const disableSchedulerTimeoutInWorkLoop = false;
36
packages/shared/forks/ReactFeatureFlags.native-fb.js
-1
@@ -66,7 +66,6 @@ export const enableTransitionTracing = false;
66 export const enableTrustedTypesIntegration = false;
67 export const enableUpdaterTracking = __PROFILE__;
68 export const enableUseEffectEventHook = false;
69 -export const favorSafetyOverHydrationPerf = true;
69 export const retryLaneExpirationMs = 5000;
70 export const syncLaneExpirationMs = 250;
71 export const transitionLaneExpirationMs = 5000;
packages/shared/forks/ReactFeatureFlags.native-oss.js
-1
@@ -52,7 +52,6 @@ export const enableTaint = true;
52 export const enableTransitionTracing = false;
53 export const enableTrustedTypesIntegration = false;
54 export const enableUseEffectEventHook = false;
55 -export const favorSafetyOverHydrationPerf = true;
55 export const passChildrenWhenCloningPersistedNodes = false;
56 export const renameElementSymbol = true;
57 export const retryLaneExpirationMs = 5000;
packages/shared/forks/ReactFeatureFlags.test-renderer.js
-1
@@ -33,7 +33,6 @@ export const enableSuspenseAvoidThisFallback = false;
33 export const enableCPUSuspense = false;
34 export const enableNoCloningMemoCache = false;
35 export const enableUseEffectEventHook = false;
36 -export const favorSafetyOverHydrationPerf = true;
36 export const enableLegacyFBSupport = false;
37 export const enableMoveBefore = false;
38 export const enableHiddenSubtreeInsertionEffectCleanup = false;
packages/shared/forks/ReactFeatureFlags.test-renderer.native-fb.js
-1
@@ -52,7 +52,6 @@ export const enableTransitionTracing = false;
52 export const enableTrustedTypesIntegration = false;
53 export const enableUpdaterTracking = false;
54 export const enableUseEffectEventHook = false;
55 -export const favorSafetyOverHydrationPerf = true;
55 export const passChildrenWhenCloningPersistedNodes = false;
56 export const renameElementSymbol = false;
57 export const retryLaneExpirationMs = 5000;
packages/shared/forks/ReactFeatureFlags.test-renderer.www.js
-1
@@ -35,7 +35,6 @@ export const enableSuspenseAvoidThisFallback = true;
35 export const enableCPUSuspense = false;
36 export const enableNoCloningMemoCache = false;
37 export const enableUseEffectEventHook = false;
38 -export const favorSafetyOverHydrationPerf = true;
38 export const enableLegacyFBSupport = false;
39 export const enableMoveBefore = false;
40 export const enableHiddenSubtreeInsertionEffectCleanup = true;
packages/shared/forks/ReactFeatureFlags.www-dynamic.js
-1
@@ -21,7 +21,6 @@ export const enableNoCloningMemoCache = __VARIANT__;
21 export const enableObjectFiber = __VARIANT__;
22 export const enableRetryLaneExpiration = __VARIANT__;
23 export const enableTransitionTracing = __VARIANT__;
24 -export const favorSafetyOverHydrationPerf = __VARIANT__;
24 export const renameElementSymbol = __VARIANT__;
25 export const retryLaneExpirationMs = 5000;
26 export const syncLaneExpirationMs = 250;
packages/shared/forks/ReactFeatureFlags.www.js
-1
@@ -25,7 +25,6 @@ export const {
25 enableRetryLaneExpiration,
26 enableTransitionTracing,
27 enableTrustedTypesIntegration,
28 - favorSafetyOverHydrationPerf,
28 renameElementSymbol,
29 retryLaneExpirationMs,
30 syncLaneExpirationMs,