Skip to content

Commit dbb4b12

Browse files
committed
Activity: rename Offscreen to Activity
1 parent d947c2f commit dbb4b12

13 files changed

+216
-220
lines changed

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

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010

1111
'use strict';
1212

13+
let Activity;
1314
let React = require('react');
1415
let ReactDOM;
1516
let ReactDOMClient;
1617
let ReactDOMServer;
17-
let Scheduler;
1818
let ReactFeatureFlags;
19+
let Scheduler;
1920
let Suspense;
2021
let SuspenseList;
21-
let Offscreen;
2222
let useSyncExternalStore;
2323
let act;
2424
let IdleEventPriority;
@@ -112,8 +112,8 @@ describe('ReactDOMServerPartialHydration', () => {
112112
act = require('internal-test-utils').act;
113113
ReactDOMServer = require('react-dom/server');
114114
Scheduler = require('scheduler');
115+
Activity = React.unstable_Activity;
115116
Suspense = React.Suspense;
116-
Offscreen = React.unstable_Offscreen;
117117
useSyncExternalStore = React.useSyncExternalStore;
118118
if (gate(flags => flags.enableSuspenseList)) {
119119
SuspenseList = React.unstable_SuspenseList;
@@ -778,7 +778,7 @@ describe('ReactDOMServerPartialHydration', () => {
778778
expect(span).not.toBe(span2);
779779

780780
if (gate(flags => flags.dfsEffectsRefactor)) {
781-
// The effects list refactor causes this to be null because the Suspense Offscreen's child
781+
// The effects list refactor causes this to be null because the Suspense Activity's child
782782
// is null. However, since we can't hydrate Suspense in legacy this change in behavior is ok
783783
expect(ref.current).toBe(null);
784784
} else {
@@ -3152,14 +3152,14 @@ describe('ReactDOMServerPartialHydration', () => {
31523152
});
31533153

31543154
// @gate enableOffscreen
3155-
it('a visible Offscreen component acts like a fragment', async () => {
3155+
it('a visible Activity component acts like a fragment', async () => {
31563156
const ref = React.createRef();
31573157

31583158
function App() {
31593159
return (
3160-
<Offscreen mode="visible">
3160+
<Activity mode="visible">
31613161
<span ref={ref}>Child</span>
3162-
</Offscreen>
3162+
</Activity>
31633163
);
31643164
}
31653165

@@ -3169,7 +3169,7 @@ describe('ReactDOMServerPartialHydration', () => {
31693169
const container = document.createElement('div');
31703170
container.innerHTML = finalHTML;
31713171

3172-
// Visible Offscreen boundaries behave exactly like fragments: a
3172+
// Visible Activity boundaries behave exactly like fragments: a
31733173
// pure indirection.
31743174
expect(container).toMatchInlineSnapshot(`
31753175
<div>
@@ -3188,7 +3188,7 @@ describe('ReactDOMServerPartialHydration', () => {
31883188
});
31893189

31903190
// @gate enableOffscreen
3191-
it('a hidden Offscreen component is skipped over during server rendering', async () => {
3191+
it('a hidden Activity component is skipped over during server rendering', async () => {
31923192
const visibleRef = React.createRef();
31933193

31943194
function HiddenChild() {
@@ -3201,9 +3201,9 @@ describe('ReactDOMServerPartialHydration', () => {
32013201
return (
32023202
<>
32033203
<span ref={visibleRef}>Visible</span>
3204-
<Offscreen mode="hidden">
3204+
<Activity mode="hidden">
32053205
<HiddenChild />
3206-
</Offscreen>
3206+
</Activity>
32073207
</>
32083208
);
32093209
}

packages/react-reconciler/src/__tests__/ReactCache-test.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ let Scheduler;
66
let assertLog;
77
let act;
88
let Suspense;
9-
let Offscreen;
9+
let Activity;
1010
let useCacheRefresh;
1111
let startTransition;
1212
let useState;
@@ -27,7 +27,7 @@ describe('ReactCache', () => {
2727
act = require('internal-test-utils').act;
2828
Suspense = React.Suspense;
2929
cache = React.cache;
30-
Offscreen = React.unstable_Offscreen;
30+
Activity = React.unstable_Activity;
3131
getCacheSignal = React.unstable_getCacheSignal;
3232
useCacheRefresh = React.unstable_useCacheRefresh;
3333
startTransition = React.startTransition;
@@ -1578,18 +1578,18 @@ describe('ReactCache', () => {
15781578

15791579
// @gate enableOffscreen
15801580
// @gate enableCache
1581-
test('prerender a new cache boundary inside an Offscreen tree', async () => {
1581+
test('prerender a new cache boundary inside an Activity tree', async () => {
15821582
function App({prerenderMore}) {
15831583
return (
1584-
<Offscreen mode="hidden">
1584+
<Activity mode="hidden">
15851585
<div>
15861586
{prerenderMore ? (
15871587
<Cache>
15881588
<AsyncText text="More" />
15891589
</Cache>
15901590
) : null}
15911591
</div>
1592-
</Offscreen>
1592+
</Activity>
15931593
);
15941594
}
15951595

packages/react-reconciler/src/__tests__/ReactDeferredValue-test.js

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ let useDeferredValue;
1616
let useMemo;
1717
let useState;
1818
let Suspense;
19-
let Offscreen;
19+
let Activity;
2020
let assertLog;
2121
let waitForPaint;
2222
let textCache;
@@ -34,7 +34,7 @@ describe('ReactDeferredValue', () => {
3434
useMemo = React.useMemo;
3535
useState = React.useState;
3636
Suspense = React.Suspense;
37-
Offscreen = React.unstable_Offscreen;
37+
Activity = React.unstable_Activity;
3838

3939
const InternalTestUtils = require('internal-test-utils');
4040
assertLog = InternalTestUtils.assertLog;
@@ -585,9 +585,7 @@ describe('ReactDeferredValue', () => {
585585
const [shouldShow, setState] = useState(false);
586586
revealContent = () => setState(true);
587587
return (
588-
<Offscreen mode={shouldShow ? 'visible' : 'hidden'}>
589-
{children}
590-
</Offscreen>
588+
<Activity mode={shouldShow ? 'visible' : 'hidden'}>{children}</Activity>
591589
);
592590
}
593591

@@ -634,9 +632,7 @@ describe('ReactDeferredValue', () => {
634632
const [shouldShow, setState] = useState(false);
635633
revealContent = () => setState(true);
636634
return (
637-
<Offscreen mode={shouldShow ? 'visible' : 'hidden'}>
638-
{children}
639-
</Offscreen>
635+
<Activity mode={shouldShow ? 'visible' : 'hidden'}>{children}</Activity>
640636
);
641637
}
642638

@@ -695,9 +691,9 @@ describe('ReactDeferredValue', () => {
695691

696692
function Container({text, shouldShow}) {
697693
return (
698-
<Offscreen mode={shouldShow ? 'visible' : 'hidden'}>
694+
<Activity mode={shouldShow ? 'visible' : 'hidden'}>
699695
<App text={text} />
700-
</Offscreen>
696+
</Activity>
701697
);
702698
}
703699

@@ -736,9 +732,9 @@ describe('ReactDeferredValue', () => {
736732

737733
function Container({text, shouldShow}) {
738734
return (
739-
<Offscreen mode={shouldShow ? 'visible' : 'hidden'}>
735+
<Activity mode={shouldShow ? 'visible' : 'hidden'}>
740736
<App text={text} />
741-
</Offscreen>
737+
</Activity>
742738
);
743739
}
744740

@@ -781,9 +777,9 @@ describe('ReactDeferredValue', () => {
781777

782778
function Container({text, shouldShow}) {
783779
return (
784-
<Offscreen mode={shouldShow ? 'visible' : 'hidden'}>
780+
<Activity mode={shouldShow ? 'visible' : 'hidden'}>
785781
<App text={text} />
786-
</Offscreen>
782+
</Activity>
787783
);
788784
}
789785

0 commit comments

Comments
 (0)