[flags] Cleanup `enableActivity` (#35681)
Sebastian "Sebbie" Silbermann committed
Feb 3, 2026 at 16:08 UTC
3419420e8b8415c80ead82e4d95f0a039380aee5
17 files changed
+27
-130
packages/react-dom/src/__tests__/ReactDOMActivity-test.js
-7
@@ -54,7 +54,6 @@ describe('ReactDOMActivity', () => {
54
return <span prop={props.text}>{props.children}</span>;
55
}
56
57
- // @gate enableActivity
57
it(
58
'hiding an Activity boundary also hides the direct children of any ' +
59
'portals it contains, regardless of how deeply nested they are',
@@ -100,7 +99,6 @@ describe('ReactDOMActivity', () => {
99
},
100
);
101
103
- // @gate enableActivity
102
it(
103
'revealing an Activity boundary inside a portal does not reveal the ' +
104
'portal contents if has a hidden Activity parent',
@@ -151,7 +149,6 @@ describe('ReactDOMActivity', () => {
149
},
150
);
151
154
- // @gate enableActivity
152
it('hides new portals added to an already hidden tree', async () => {
153
function Child() {
154
return <Text text="Child" />;
@@ -218,7 +215,6 @@ describe('ReactDOMActivity', () => {
215
);
216
});
217
221
- // @gate enableActivity
218
it('hides new insertions inside an already hidden portal', async () => {
219
function Child({text}) {
220
useLayoutEffect(() => {
@@ -289,7 +285,6 @@ describe('ReactDOMActivity', () => {
285
);
286
});
287
292
- // @gate enableActivity
288
it('reveal an inner Suspense boundary without revealing an outer Activity on the same host child', async () => {
289
const promise = new Promise(() => {});
290
@@ -390,7 +385,6 @@ describe('ReactDOMActivity', () => {
385
);
386
});
387
393
- // @gate enableActivity
388
it('mounts/unmounts layout effects in portal when visibility changes (starting visible)', async () => {
389
function Child() {
390
useLayoutEffect(() => {
@@ -440,7 +434,6 @@ describe('ReactDOMActivity', () => {
434
);
435
});
436
443
- // @gate enableActivity
437
it('mounts/unmounts layout effects in portal when visibility changes (starting hidden)', async () => {
438
function Child() {
439
useLayoutEffect(() => {
packages/react-dom/src/__tests__/ReactDOMFragmentRefs-test.js
+3
-3
@@ -763,7 +763,7 @@ describe('FragmentRefs', () => {
763
});
764
765
describe('with activity', () => {
766
- // @gate enableFragmentRefs && enableActivity
766
+ // @gate enableFragmentRefs
767
it('does not apply event listeners to hidden trees', async () => {
768
const parentRef = React.createRef();
769
const fragmentRef = React.createRef();
@@ -799,7 +799,7 @@ describe('FragmentRefs', () => {
799
expect(logs).toEqual(['Child 1', 'Child 3']);
800
});
801
802
- // @gate enableFragmentRefs && enableActivity
802
+ // @gate enableFragmentRefs
803
it('applies event listeners to visible trees', async () => {
804
const parentRef = React.createRef();
805
const fragmentRef = React.createRef();
@@ -835,7 +835,7 @@ describe('FragmentRefs', () => {
835
expect(logs).toEqual(['Child 1', 'Child 2', 'Child 3']);
836
});
837
838
- // @gate enableFragmentRefs && enableActivity
838
+ // @gate enableFragmentRefs
839
it('handles Activity modes switching', async () => {
840
const fragmentRef = React.createRef();
841
const fragmentRef2 = React.createRef();
packages/react-dom/src/__tests__/ReactDOMServerPartialHydration-test.internal.js
-2
@@ -3668,7 +3668,6 @@ describe('ReactDOMServerPartialHydration', () => {
3668
expect(ref.current.innerHTML).toBe('Hidden child');
3669
});
3670
3671
- // @gate enableActivity
3671
it('a visible Activity component is surrounded by comment markers', async () => {
3672
const ref = React.createRef();
3673
@@ -3706,7 +3705,6 @@ describe('ReactDOMServerPartialHydration', () => {
3705
expect(ref.current).toBe(span);
3706
});
3707
3709
- // @gate enableActivity
3708
it('a hidden Activity component is skipped over during server rendering', async () => {
3709
const visibleRef = React.createRef();
3710
packages/react-dom/src/__tests__/ReactDOMServerPartialHydrationActivity-test.internal.js
+3
-38
@@ -113,7 +113,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
113
IdleEventPriority = require('react-reconciler/constants').IdleEventPriority;
114
});
115
116
- // @gate enableActivity
116
it('hydrates a parent even if a child Activity boundary is blocked', async () => {
117
let suspend = false;
118
let resolve;
@@ -169,7 +168,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
168
expect(ref.current).toBe(span);
169
});
170
172
- // @gate enableActivity
171
it('can hydrate siblings of a suspended component without errors', async () => {
172
let suspend = false;
173
let resolve;
@@ -228,7 +226,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
226
expect(container.textContent).toBe('HelloHello');
227
});
228
231
- // @gate enableActivity
229
it('falls back to client rendering boundary on mismatch', async () => {
230
let client = false;
231
let suspend = false;
@@ -321,7 +318,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
318
);
319
});
320
324
- // @gate enableActivity
321
it('handles if mismatch is after suspending', async () => {
322
let client = false;
323
let suspend = false;
@@ -401,7 +397,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
397
expect(container.innerHTML).toBe('Hello<article>Mismatch</article>');
398
});
399
404
- // @gate enableActivity
400
it('handles if mismatch is child of suspended component', async () => {
401
let client = false;
402
let suspend = false;
@@ -482,7 +477,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
477
expect(container.innerHTML).toBe('<div><article>Mismatch</article></div>');
478
});
479
485
- // @gate enableActivity
480
it('handles if mismatch is parent and first child suspends', async () => {
481
let client = false;
482
let suspend = false;
@@ -575,7 +569,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
569
);
570
});
571
578
- // @gate enableActivity
572
it('does show a parent fallback if mismatch is parent and second child suspends', async () => {
573
let client = false;
574
let suspend = false;
@@ -687,7 +680,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
680
);
681
});
682
690
- // @gate enableActivity
683
it('does show a parent fallback if mismatch is in parent element only', async () => {
684
let client = false;
685
let suspend = false;
@@ -787,7 +779,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
779
);
780
});
781
790
- // @gate enableActivity
782
it('does show a parent fallback if mismatch is before suspending', async () => {
783
let client = false;
784
let suspend = false;
@@ -886,7 +877,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
877
);
878
});
879
889
- // @gate enableActivity
880
it('does show a parent fallback if mismatch is before suspending in a child', async () => {
881
let client = false;
882
let suspend = false;
@@ -987,7 +977,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
977
);
978
});
979
990
- // @gate enableActivity
980
it('calls the hydration callbacks after hydration or deletion', async () => {
981
let suspend = false;
982
let resolve;
@@ -1079,7 +1068,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1068
expect(deleted.length).toBe(1);
1069
});
1070
1082
- // @gate enableActivity
1071
it('hydrates an empty activity boundary', async () => {
1072
function App() {
1073
return (
@@ -1101,7 +1089,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1089
expect(container.innerHTML).toContain('<div>Sibling</div>');
1090
});
1091
1104
- // @gate enableActivity
1092
it('recovers with client render when server rendered additional nodes at suspense root', async () => {
1093
function CheckIfHydrating({children}) {
1094
// This is a trick to check whether we're hydrating or not, since React
@@ -1171,7 +1158,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1158
expect(ref.current).not.toBe(span);
1159
});
1160
1174
- // @gate enableActivity
1161
it('recovers with client render when server rendered additional nodes at suspense root after unsuspending', async () => {
1162
const ref = React.createRef();
1163
let shouldSuspend = false;
@@ -1236,7 +1222,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1222
expect(ref.current).not.toBe(span);
1223
});
1224
1239
- // @gate enableActivity
1225
it('recovers with client render when server rendered additional nodes deep inside suspense root', async () => {
1226
const ref = React.createRef();
1227
function App({hasB}) {
@@ -1283,7 +1268,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1268
expect(ref.current).not.toBe(span);
1269
});
1270
1286
- // @gate enableActivity
1271
it('calls the onDeleted hydration callback if the parent gets deleted', async () => {
1272
let suspend = false;
1273
const promise = new Promise(() => {});
@@ -1337,7 +1321,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1321
expect(deleted.length).toBe(1);
1322
});
1323
1340
- // @gate enableActivity
1324
it('can insert siblings before the dehydrated boundary', async () => {
1325
let suspend = false;
1326
const promise = new Promise(() => {});
@@ -1395,7 +1378,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1378
expect(container.firstChild.firstChild.textContent).toBe('First');
1379
});
1380
1398
- // @gate enableActivity
1381
it('can delete the dehydrated boundary before it is hydrated', async () => {
1382
let suspend = false;
1383
const promise = new Promise(() => {});
@@ -1451,7 +1433,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1433
expect(container.firstChild.children[1].textContent).toBe('After');
1434
});
1435
1454
- // @gate enableActivity
1436
it('blocks updates to hydrate the content first if props have changed', async () => {
1437
let suspend = false;
1438
let resolve;
@@ -1523,7 +1504,7 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1504
expect(span.className).toBe('hi');
1505
});
1506
1526
- // @gate enableActivity && www
1507
+ // @gate www
1508
it('blocks updates to hydrate the content first if props changed at idle priority', async () => {
1509
let suspend = false;
1510
let resolve;
@@ -1597,7 +1578,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1578
expect(span.className).toBe('hi');
1579
});
1580
1600
- // @gate enableActivity
1581
it('shows the fallback of the parent if props have changed before hydration completes and is still suspended', async () => {
1582
let suspend = false;
1583
let resolve;
@@ -1684,7 +1664,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1664
expect(container.textContent).toBe('Hi');
1665
});
1666
1687
- // @gate enableActivity
1667
it('clears nested activity boundaries if they did not hydrate yet', async () => {
1668
let suspend = false;
1669
const promise = new Promise(() => {});
@@ -1752,7 +1731,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1731
expect(container.textContent).toBe('Hi Hi');
1732
});
1733
1755
- // @gate enableActivity
1734
it('hydrates first if props changed but we are able to resolve within a timeout', async () => {
1735
let suspend = false;
1736
let resolve;
@@ -1826,7 +1804,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1804
expect(span.className).toBe('hi');
1805
});
1806
1829
- // @gate enableActivity
1807
it('warns but works if setState is called before commit in a dehydrated component', async () => {
1808
let suspend = false;
1809
let resolve;
@@ -1901,7 +1878,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1878
expect(container.textContent).toBe('Hello');
1879
});
1880
1904
- // @gate enableActivity
1881
it('blocks the update to hydrate first if context has changed', async () => {
1882
let suspend = false;
1883
let resolve;
@@ -1984,7 +1960,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
1960
expect(span.className).toBe('hi');
1961
});
1962
1987
- // @gate enableActivity
1963
it('shows the parent fallback if context has changed before hydration completes and is still suspended', async () => {
1964
let suspend = false;
1965
let resolve;
@@ -2075,7 +2050,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
2050
expect(container.textContent).toBe('Hi');
2051
});
2052
2078
- // @gate enableActivity
2053
it('can hydrate TWO activity boundaries', async () => {
2054
const ref1 = React.createRef();
2055
const ref2 = React.createRef();
@@ -2113,7 +2087,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
2087
expect(ref2.current).toBe(span2);
2088
});
2089
2116
- // @gate enableActivity
2090
it('regenerates if it cannot hydrate before changes to props/context expire', async () => {
2091
let suspend = false;
2092
const promise = new Promise(resolvePromise => {});
@@ -2201,7 +2174,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
2174
expect(newSpan.className).toBe('hi');
2175
});
2176
2204
- // @gate enableActivity
2177
it('does not invoke an event on a hydrated node until it commits', async () => {
2178
let suspend = false;
2179
let resolve;
@@ -2281,7 +2253,7 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
2253
document.body.removeChild(container);
2254
});
2255
2284
- // @gate enableActivity && www
2256
+ // @gate www
2257
it('does not invoke an event on a hydrated event handle until it commits', async () => {
2258
const setClick = ReactDOM.unstable_createEventHandle('click');
2259
let suspend = false;
@@ -2363,7 +2335,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
2335
document.body.removeChild(container);
2336
});
2337
2366
- // @gate enableActivity
2338
it('invokes discrete events on nested activity boundaries in a root (legacy system)', async () => {
2339
let suspend = false;
2340
let resolve;
@@ -2444,7 +2415,7 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
2415
document.body.removeChild(container);
2416
});
2417
2447
- // @gate enableActivity && www
2418
+ // @gate www
2419
it('invokes discrete events on nested activity boundaries in a root (createEventHandle)', async () => {
2420
let suspend = false;
2421
let isServerRendering = true;
@@ -2529,7 +2500,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
2500
document.body.removeChild(container);
2501
});
2502
2532
- // @gate enableActivity
2503
it('does not invoke the parent of dehydrated boundary event', async () => {
2504
let suspend = false;
2505
let resolve;
@@ -2602,7 +2572,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
2572
document.body.removeChild(container);
2573
});
2574
2605
- // @gate enableActivity
2575
it('does not invoke an event on a parent tree when a subtree is dehydrated', async () => {
2576
let suspend = false;
2577
let resolve;
@@ -2675,7 +2644,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
2644
document.body.removeChild(parentContainer);
2645
});
2646
2678
- // @gate enableActivity
2647
it('blocks only on the last continuous event (legacy system)', async () => {
2648
let suspend1 = false;
2649
let resolve1;
@@ -2776,7 +2744,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
2744
document.body.removeChild(container);
2745
});
2746
2779
- // @gate enableActivity
2747
it('finishes normal pri work before continuing to hydrate a retry', async () => {
2748
let suspend = false;
2749
let resolve;
@@ -2860,7 +2827,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
2827
expect(ref.current).not.toBe(null);
2828
});
2829
2863
- // @gate enableActivity
2830
it('regression test: does not overfire non-bubbling browser events', async () => {
2831
let suspend = false;
2832
let resolve;
@@ -2945,7 +2911,6 @@ describe('ReactDOMServerPartialHydrationActivity', () => {
2911
document.body.removeChild(container);
2912
});
2913
2948
- // @gate enableActivity
2914
it('fallback to client render on hydration mismatch at root', async () => {
2915
let suspend = true;
2916
let resolve;
packages/react-dom/src/__tests__/ReactDOMServerSelectiveHydrationActivity-test.internal.js
+6
-20
@@ -152,7 +152,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
152
require('react-reconciler/constants').ContinuousEventPriority;
153
});
154
155
- // @gate enableActivity
155
it('hydrates the target boundary synchronously during a click', async () => {
156
function Child({text}) {
157
Scheduler.log(text);
@@ -214,7 +213,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
213
document.body.removeChild(container);
214
});
215
217
- // @gate enableActivity
216
it('hydrates at higher pri if sync did not work first time', async () => {
217
let suspend = false;
218
let resolve;
@@ -300,7 +298,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
298
document.body.removeChild(container);
299
});
300
303
- // @gate enableActivity
301
it('hydrates at higher pri for secondary discrete events', async () => {
302
let suspend = false;
303
let resolve;
@@ -388,7 +385,7 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
385
document.body.removeChild(container);
386
});
387
391
- // @gate enableActivity && www
388
+ // @gate www
389
it('hydrates the target boundary synchronously during a click (createEventHandle)', async () => {
390
const setClick = ReactDOM.unstable_createEventHandle('click');
391
let isServerRendering = true;
@@ -455,7 +452,7 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
452
document.body.removeChild(container);
453
});
454
458
- // @gate enableActivity && www
455
+ // @gate www
456
it('hydrates at higher pri if sync did not work first time (createEventHandle)', async () => {
457
let suspend = false;
458
let isServerRendering = true;
@@ -544,7 +541,7 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
541
document.body.removeChild(container);
542
});
543
547
- // @gate enableActivity && www
544
+ // @gate www
545
it('hydrates at higher pri for secondary discrete events (createEventHandle)', async () => {
546
const setClick = ReactDOM.unstable_createEventHandle('click');
547
let suspend = false;
@@ -636,7 +633,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
633
document.body.removeChild(container);
634
});
635
639
- // @gate enableActivity
636
it('hydrates the hovered targets as higher priority for continuous events', async () => {
637
let suspend = false;
638
let resolve;
@@ -729,7 +725,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
725
document.body.removeChild(container);
726
});
727
732
- // @gate enableActivity
728
it('replays capture phase for continuous events and respects stopPropagation', async () => {
729
let suspend = false;
730
let resolve;
@@ -883,7 +878,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
878
document.body.removeChild(container);
879
});
880
886
- // @gate enableActivity
881
it('replays event with null target when tree is dismounted', async () => {
882
let suspend = false;
883
let resolve;
@@ -957,7 +951,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
951
document.body.removeChild(container);
952
});
953
960
- // @gate enableActivity
954
it('hydrates the last target path first for continuous events', async () => {
955
let suspend = false;
956
let resolve;
@@ -1044,7 +1037,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
1037
document.body.removeChild(container);
1038
});
1039
1047
- // @gate enableActivity
1040
it('hydrates the last explicitly hydrated target at higher priority', async () => {
1041
function Child({text}) {
1042
Scheduler.log(text);
@@ -1092,7 +1084,7 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
1084
await waitForAll(['App', 'C', 'B', 'A']);
1085
});
1086
1095
- // @gate enableActivity && www
1087
+ // @gate www
1088
it('hydrates before an update even if hydration moves away from it', async () => {
1089
function Child({text}) {
1090
Scheduler.log(text);
@@ -1200,7 +1192,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
1192
document.body.removeChild(container);
1193
});
1194
1203
- // @gate enableActivity
1195
it('fires capture event handlers and native events if content is hydratable during discrete event', async () => {
1196
spyOnDev(console, 'error');
1197
function Child({text}) {
@@ -1272,7 +1263,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
1263
document.body.removeChild(container);
1264
});
1265
1275
- // @gate enableActivity
1266
it('does not propagate discrete event if it cannot be synchronously hydrated', async () => {
1267
let triggeredParent = false;
1268
let triggeredChild = false;
@@ -1335,7 +1325,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
1325
expect(triggeredChild).toBe(false);
1326
});
1327
1338
- // @gate enableActivity
1328
it('can force hydration in response to sync update', async () => {
1329
function Child({text}) {
1330
Scheduler.log(`Child ${text}`);
@@ -1371,7 +1360,7 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
1360
expect(initialSpan).toBe(spanRef);
1361
});
1362
1374
- // @gate enableActivity && www
1363
+ // @gate www
1364
it('can force hydration in response to continuous update', async () => {
1365
function Child({text}) {
1366
Scheduler.log(`Child ${text}`);
@@ -1408,7 +1397,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
1397
expect(initialSpan).toBe(spanRef);
1398
});
1399
1411
- // @gate enableActivity
1400
it('can force hydration in response to default update', async () => {
1401
function Child({text}) {
1402
Scheduler.log(`Child ${text}`);
@@ -1441,7 +1429,7 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
1429
expect(initialSpan).toBe(spanRef);
1430
});
1431
1444
- // @gate enableActivity && www
1432
+ // @gate www
1433
it('regression test: can unwind context on selective hydration interruption', async () => {
1434
const Context = React.createContext('DefaultContext');
1435
@@ -1500,7 +1488,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
1488
});
1489
});
1490
1503
- // @gate enableActivity
1491
it('regression test: can unwind context on selective hydration interruption for sync updates', async () => {
1492
const Context = React.createContext('DefaultContext');
1493
@@ -1552,7 +1539,6 @@ describe('ReactDOMServerSelectiveHydrationActivity', () => {
1539
});
1540
});
1541
1555
- // @gate enableActivity
1542
it('regression: selective hydration does not contribute to "maximum update limit" count', async () => {
1543
const outsideRef = React.createRef(null);
1544
const insideRef = React.createRef(null);
packages/react-reconciler/src/__tests__/Activity-test.js
-23
@@ -196,7 +196,6 @@ describe('Activity', () => {
196
);
197
});
198
199
- // @gate enableActivity
199
it('mounts without layout effects when hidden', async () => {
200
function Child({text}) {
201
useLayoutEffect(() => {
@@ -234,7 +233,6 @@ describe('Activity', () => {
233
expect(root).toMatchRenderedOutput(<span prop="Child" />);
234
});
235
237
- // @gate enableActivity
236
it('mounts/unmounts layout effects when visibility changes (starting visible)', async () => {
237
function Child({text}) {
238
useLayoutEffect(() => {
@@ -280,7 +278,6 @@ describe('Activity', () => {
278
expect(root).toMatchRenderedOutput(<span prop="Child" />);
279
});
280
283
- // @gate enableActivity
281
it('nested offscreen does not call componentWillUnmount when hidden', async () => {
282
// This is a bug that appeared during production test of <Activity />.
283
// It is a very specific scenario with nested Offscreens. The inner offscreen
@@ -384,7 +381,6 @@ describe('Activity', () => {
381
assertLog(['child']);
382
});
383
387
- // @gate enableActivity
384
it('mounts/unmounts layout effects when visibility changes (starting hidden)', async () => {
385
function Child({text}) {
386
useLayoutEffect(() => {
@@ -431,7 +427,6 @@ describe('Activity', () => {
427
expect(root).toMatchRenderedOutput(<span hidden={true} prop="Child" />);
428
});
429
434
- // @gate enableActivity
430
it('hides children of offscreen after layout effects are destroyed', async () => {
431
const root = ReactNoop.createRoot();
432
function Child({text}) {
@@ -518,7 +513,6 @@ describe('Activity', () => {
513
assertLog(['Unmount layout']);
514
});
515
521
- // @gate enableActivity
516
it('hides new insertions into an already hidden tree', async () => {
517
const root = ReactNoop.createRoot();
518
await act(() => {
@@ -548,7 +542,6 @@ describe('Activity', () => {
542
);
543
});
544
551
- // @gate enableActivity
545
it('hides updated nodes inside an already hidden tree', async () => {
546
const root = ReactNoop.createRoot();
547
await act(() => {
@@ -594,7 +587,6 @@ describe('Activity', () => {
587
expect(root).toMatchRenderedOutput(<span>Hi</span>);
588
});
589
597
- // @gate enableActivity
590
it('revealing a hidden tree at high priority does not cause tearing', async () => {
591
// When revealing an offscreen tree, we need to include updates that were
592
// previously deferred because the tree was hidden, even if they are lower
@@ -723,7 +715,6 @@ describe('Activity', () => {
715
expect(areOuterAndInnerConsistent()).toBe(true);
716
});
717
726
- // @gate enableActivity
718
it('regression: Activity instance is sometimes null during setState', async () => {
719
let setState;
720
function Child() {
@@ -774,7 +765,6 @@ describe('Activity', () => {
765
expect(root).toMatchRenderedOutput(null);
766
});
767
777
- // @gate enableActivity
768
it('class component setState callbacks do not fire until tree is visible', async () => {
769
const root = ReactNoop.createRoot();
770
@@ -826,7 +816,6 @@ describe('Activity', () => {
816
expect(root).toMatchRenderedOutput(<span prop="C" />);
817
});
818
829
- // @gate enableActivity
819
it('does not call componentDidUpdate when reappearing a hidden class component', async () => {
820
class Child extends React.Component {
821
componentDidMount() {
@@ -876,7 +865,6 @@ describe('Activity', () => {
865
assertLog(['componentDidMount']);
866
});
867
879
- // @gate enableActivity
868
it(
869
'when reusing old components (hidden -> visible), layout effects fire ' +
870
'with same timing as if it were brand new',
@@ -929,7 +917,6 @@ describe('Activity', () => {
917
},
918
);
919
932
- // @gate enableActivity
920
it(
921
'when reusing old components (hidden -> visible), layout effects fire ' +
922
'with same timing as if it were brand new (includes setState callback)',
@@ -992,7 +979,6 @@ describe('Activity', () => {
979
},
980
);
981
995
- // @gate enableActivity
982
it('defer passive effects when prerendering a new Activity tree', async () => {
983
function Child({label}) {
984
useEffect(() => {
@@ -1110,7 +1096,6 @@ describe('Activity', () => {
1096
assertLog(['Shell', 'More']);
1097
});
1098
1113
- // @gate enableActivity
1099
it('passive effects are connected and disconnected when the visibility changes', async () => {
1100
function Child({step}) {
1101
useEffect(() => {
@@ -1167,7 +1152,6 @@ describe('Activity', () => {
1152
expect(root).toMatchRenderedOutput(<span prop={2} />);
1153
});
1154
1170
- // @gate enableActivity
1155
it('passive effects are unmounted on hide in the same order as during a deletion: parent before child', async () => {
1156
function Child({label}) {
1157
useEffect(() => {
@@ -1225,7 +1209,6 @@ describe('Activity', () => {
1209
// Re-enable this test once we add this ability. For example, we'll likely add
1210
// either an option or a heuristic to mount passive effects inside a hidden
1211
// tree after a delay.
1228
- // @gate enableActivity
1212
// eslint-disable-next-line jest/no-disabled-tests
1213
it.skip("don't defer passive effects when prerendering in a tree whose effects are already connected", async () => {
1214
function Child({label}) {
@@ -1282,7 +1265,6 @@ describe('Activity', () => {
1265
]);
1266
});
1267
1285
- // @gate enableActivity
1268
it('does not mount effects when prerendering a nested Activity boundary', async () => {
1269
function Child({label}) {
1270
useEffect(() => {
@@ -1360,7 +1342,6 @@ describe('Activity', () => {
1342
);
1343
});
1344
1363
- // @gate enableActivity
1345
it('reveal an outer Activity boundary without revealing an inner one', async () => {
1346
function Child({label}) {
1347
useEffect(() => {
@@ -1426,7 +1407,6 @@ describe('Activity', () => {
1407
);
1408
});
1409
1429
- // @gate enableActivity
1410
it('reveal an inner Activity boundary without revealing an outer one on the same host child', async () => {
1411
// This ensures that no update is scheduled, which would cover up the bug if the parent
1412
// then re-hides the child on the way up.
@@ -1455,7 +1435,6 @@ describe('Activity', () => {
1435
expect(root).toMatchRenderedOutput(<div hidden={true} />);
1436
});
1437
1458
- // @gate enableActivity
1438
it('reveal an inner Suspense boundary without revealing an outer Activity on the same host child', async () => {
1439
// This ensures that no update is scheduled, which would cover up the bug if the parent
1440
// then re-hides the child on the way up.
@@ -1492,7 +1471,6 @@ describe('Activity', () => {
1471
expect(root).toMatchRenderedOutput(<div hidden={true} />);
1472
});
1473
1495
- // @gate enableActivity
1474
it('insertion effects are not disconnected when the visibility changes', async () => {
1475
function Child({step}) {
1476
useInsertionEffect(() => {
@@ -1549,7 +1527,6 @@ describe('Activity', () => {
1527
expect(root).toMatchRenderedOutput(<span prop={2} />);
1528
});
1529
1552
- // @gate enableActivity
1530
it('warns if you pass a hidden prop', async () => {
1531
function App() {
1532
return (
packages/react-reconciler/src/__tests__/ActivityErrorHandling-test.js
-1
@@ -26,7 +26,6 @@ describe('Activity error handling', () => {
26
return text;
27
}
28
29
- // @gate enableActivity
29
it(
30
'errors inside a hidden Activity do not escape in the visible part ' +
31
'of the UI',
packages/react-reconciler/src/__tests__/ActivityLegacySuspense-test.js
+1
-7
@@ -98,7 +98,6 @@ describe('Activity Suspense', () => {
98
return text;
99
}
100
101
- // @gate enableActivity
101
it('basic example of suspending inside hidden tree', async () => {
102
const root = ReactNoop.createRoot();
103
@@ -174,7 +173,7 @@ describe('Activity Suspense', () => {
173
);
174
});
175
177
- // @gate __DEV__ && enableActivity
176
+ // @gate __DEV__
177
test('Regression: Suspending on hide should not infinite loop.', async () => {
178
// This regression only repros in public act.
179
global.IS_REACT_ACT_ENVIRONMENT = true;
@@ -223,7 +222,6 @@ describe('Activity Suspense', () => {
222
expect(root).toMatchRenderedOutput('');
223
});
224
226
- // @gate enableActivity
225
test("suspending inside currently hidden tree that's switching to visible", async () => {
226
const root = ReactNoop.createRoot();
227
@@ -282,7 +280,6 @@ describe('Activity Suspense', () => {
280
);
281
});
282
285
- // @gate enableActivity
283
test("suspending inside currently visible tree that's switching to hidden", async () => {
284
const root = ReactNoop.createRoot();
285
@@ -368,7 +365,6 @@ describe('Activity Suspense', () => {
365
);
366
});
367
371
- // @gate enableActivity
368
test('update that suspends inside hidden tree', async () => {
369
let setText;
370
function Child() {
@@ -401,7 +397,6 @@ describe('Activity Suspense', () => {
397
});
398
});
399
404
- // @gate enableActivity
400
test('updates at multiple priorities that suspend inside hidden tree', async () => {
401
let setText;
402
let setStep;
@@ -458,7 +453,6 @@ describe('Activity Suspense', () => {
453
expect(root).toMatchRenderedOutput(<span hidden={true}>B1</span>);
454
});
455
461
- // @gate enableActivity
456
test('detect updates to a hidden tree during a concurrent event', async () => {
457
// This is a pretty complex test case. It relates to how we detect if an
458
// update is made to a hidden tree: when scheduling the update, we walk up
packages/react-reconciler/src/__tests__/ActivityStrictMode-test.js
+3
-3
@@ -31,7 +31,7 @@ describe('Activity StrictMode', () => {
31
return <span>label</span>;
32
}
33
34
- // @gate __DEV__ && enableActivity
34
+ // @gate __DEV__
35
it('should trigger strict effects when offscreen is visible', async () => {
36
await act(() => {
37
ReactNoop.render(
@@ -55,7 +55,7 @@ describe('Activity StrictMode', () => {
55
]);
56
});
57
58
- // @gate __DEV__ && enableActivity
58
+ // @gate __DEV__
59
it('should not trigger strict effects when offscreen is hidden', async () => {
60
await act(() => {
61
ReactNoop.render(
@@ -154,7 +154,7 @@ describe('Activity StrictMode', () => {
154
});
155
});
156
157
- // @gate __DEV__ && enableActivity
157
+ // @gate __DEV__
158
it('should double invoke effects on unsuspended child', async () => {
159
let shouldSuspend = true;
160
let resolve;
packages/react-reconciler/src/__tests__/ActivitySuspense-test.js
+1
-7
@@ -95,7 +95,6 @@ describe('Activity Suspense', () => {
95
return text;
96
}
97
98
- // @gate enableActivity
98
it('basic example of suspending inside hidden tree', async () => {
99
const root = ReactNoop.createRoot();
100
@@ -171,7 +170,7 @@ describe('Activity Suspense', () => {
170
);
171
});
172
174
- // @gate __DEV__ && enableActivity
173
+ // @gate __DEV__
174
test('Regression: Suspending on hide should not infinite loop.', async () => {
175
// This regression only repros in public act.
176
global.IS_REACT_ACT_ENVIRONMENT = true;
@@ -220,7 +219,6 @@ describe('Activity Suspense', () => {
219
expect(root).toMatchRenderedOutput('');
220
});
221
223
- // @gate enableActivity
222
test("suspending inside currently hidden tree that's switching to visible", async () => {
223
const root = ReactNoop.createRoot();
224
@@ -289,7 +287,6 @@ describe('Activity Suspense', () => {
287
);
288
});
289
292
- // @gate enableActivity
290
test("suspending inside currently visible tree that's switching to hidden", async () => {
291
const root = ReactNoop.createRoot();
292
@@ -380,7 +377,6 @@ describe('Activity Suspense', () => {
377
);
378
});
379
383
- // @gate enableActivity
380
test('update that suspends inside hidden tree', async () => {
381
let setText;
382
function Child() {
@@ -413,7 +409,6 @@ describe('Activity Suspense', () => {
409
});
410
});
411
416
- // @gate enableActivity
412
test('updates at multiple priorities that suspend inside hidden tree', async () => {
413
let setText;
414
let setStep;
@@ -470,7 +465,6 @@ describe('Activity Suspense', () => {
465
expect(root).toMatchRenderedOutput(<span hidden={true}>B1</span>);
466
});
467
473
- // @gate enableActivity
468
test('detect updates to a hidden tree during a concurrent event', async () => {
469
// This is a pretty complex test case. It relates to how we detect if an
470
// update is made to a hidden tree: when scheduling the update, we walk up
packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js
-5
@@ -696,7 +696,6 @@ describe('ReactDeferredValue', () => {
696
expect(root).toMatchRenderedOutput('Content');
697
});
698
699
- // @gate enableActivity
699
it('useDeferredValue can spawn a deferred task while prerendering a hidden tree', async () => {
700
function App() {
701
const text = useDeferredValue('Final', 'Preview');
@@ -742,7 +741,6 @@ describe('ReactDeferredValue', () => {
741
expect(root).toMatchRenderedOutput(<div>Final</div>);
742
});
743
745
- // @gate enableActivity
744
it('useDeferredValue can prerender the initial value inside a hidden tree', async () => {
745
function App({text}) {
746
const renderedText = useDeferredValue(text, `Preview [${text}]`);
@@ -805,7 +803,6 @@ describe('ReactDeferredValue', () => {
803
expect(root).toMatchRenderedOutput(<div>B</div>);
804
});
805
808
- // @gate enableActivity
806
it(
807
'useDeferredValue skips the preview state when revealing a hidden tree ' +
808
'if the final value is referentially identical',
@@ -845,7 +842,6 @@ describe('ReactDeferredValue', () => {
842
},
843
);
844
848
- // @gate enableActivity
845
it(
846
'useDeferredValue does not skip the preview state when revealing a ' +
847
'hidden tree if the final value is different from the currently rendered one',
@@ -890,7 +886,6 @@ describe('ReactDeferredValue', () => {
886
},
887
);
888
893
- // @gate enableActivity
889
it(
890
'useDeferredValue does not show "previous" value when revealing a hidden ' +
891
'tree (no initial value)',
packages/react-reconciler/src/__tests__/ReactErrorStacks-test.js
-1
@@ -202,7 +202,6 @@ describe('ReactFragment', () => {
202
]);
203
});
204
205
- // @gate enableActivity
205
it('includes built-in for Activity', async () => {
206
ReactNoop.createRoot({
207
onCaughtError,
packages/react-reconciler/src/__tests__/ReactHooksWithNoopRenderer-test.js
-1
@@ -3044,7 +3044,6 @@ describe('ReactHooksWithNoopRenderer', () => {
3044
});
3045
});
3046
3047
- // @gate enableActivity
3047
it('warns when setState is called from offscreen deleted insertion effect cleanup', async () => {
3048
function App(props) {
3049
const [, setX] = useState(0);
packages/react-reconciler/src/__tests__/ReactLazy-test.internal.js
-1
@@ -966,7 +966,6 @@ describe('ReactLazy', () => {
966
);
967
});
968
969
- // @gate enableActivity
969
it('throws with a useful error when wrapping Activity with lazy()', async () => {
970
const BadLazy = lazy(() => fakeImport(React.Activity));
971
packages/react-reconciler/src/__tests__/ReactSiblingPrerendering-test.js
-1
@@ -175,7 +175,6 @@ describe('ReactSiblingPrerendering', () => {
175
]);
176
});
177
178
- // @gate enableActivity
178
it("don't skip siblings when rendering inside a hidden tree", async () => {
179
function App() {
180
return (
packages/react-reconciler/src/__tests__/ReactSuspenseyCommitPhase-test.js
+1
-1
@@ -442,7 +442,7 @@ describe('ReactSuspenseyCommitPhase', () => {
442
);
443
});
444
445
- // @gate enableActivity && enableSuspenseyImages
445
+ // @gate enableSuspenseyImages
446
it("host instances don't suspend during prerendering, but do suspend when they are revealed", async () => {
447
function More() {
448
Scheduler.log('More');
packages/react-refresh/src/__tests__/ReactFreshIntegration-test.js
+9
-9
@@ -305,7 +305,7 @@ describe('ReactFreshIntegration', () => {
305
}
306
});
307
308
- // @gate __DEV__ && enableActivity
308
+ // @gate __DEV__
309
it('ignores ref for class component in hidden subtree', async () => {
310
const code = `
311
import {Activity} from 'react';
@@ -335,7 +335,7 @@ describe('ReactFreshIntegration', () => {
335
await patch(code);
336
});
337
338
- // @gate __DEV__ && enableActivity
338
+ // @gate __DEV__
339
it('ignores ref for hoistable resource in hidden subtree', async () => {
340
const code = `
341
import {Activity} from 'react';
@@ -357,7 +357,7 @@ describe('ReactFreshIntegration', () => {
357
await patch(code);
358
});
359
360
- // @gate __DEV__ && enableActivity
360
+ // @gate __DEV__
361
it('ignores ref for host component in hidden subtree', async () => {
362
const code = `
363
import {Activity} from 'react';
@@ -379,7 +379,7 @@ describe('ReactFreshIntegration', () => {
379
await patch(code);
380
});
381
382
- // @gate __DEV__ && enableActivity
382
+ // @gate __DEV__
383
it('ignores ref for Activity in hidden subtree', async () => {
384
const code = `
385
import {Activity} from 'react';
@@ -403,7 +403,7 @@ describe('ReactFreshIntegration', () => {
403
await patch(code);
404
});
405
406
- // @gate __DEV__ && enableActivity
406
+ // @gate __DEV__
407
it('ignores ref for Scope in hidden subtree', async () => {
408
const code = `
409
import {
@@ -430,7 +430,7 @@ describe('ReactFreshIntegration', () => {
430
await patch(code);
431
});
432
433
- // @gate __DEV__ && enableActivity
433
+ // @gate __DEV__
434
it('ignores ref for functional component in hidden subtree', async () => {
435
const code = `
436
import {Activity} from 'react';
@@ -458,7 +458,7 @@ describe('ReactFreshIntegration', () => {
458
await patch(code);
459
});
460
461
- // @gate __DEV__ && enableActivity
461
+ // @gate __DEV__
462
it('ignores ref for ref forwarding component in hidden subtree', async () => {
463
const code = `
464
import {
@@ -489,7 +489,7 @@ describe('ReactFreshIntegration', () => {
489
await patch(code);
490
});
491
492
- // @gate __DEV__ && enableActivity
492
+ // @gate __DEV__
493
it('ignores ref for simple memo component in hidden subtree', async () => {
494
const code = `
495
import {
@@ -520,7 +520,7 @@ describe('ReactFreshIntegration', () => {
520
await patch(code);
521
});
522
523
- // @gate __DEV__ && enableActivity
523
+ // @gate __DEV__
524
it('ignores ref for memo component in hidden subtree', async () => {
525
// A custom compare function means this won't use SimpleMemoComponent.
526
const code = `