Skip to content

Commit

Permalink
[activity] rename unstable_Offscreen to unstable_Activity (facebook#2…
Browse files Browse the repository at this point in the history
…7640)

`Activity` is the current candidate name. This PR starts the rename work
by renaming the exported unstable component name.

NOTE: downstream consumers need to rename the import when updating to
this commit.
  • Loading branch information
kassens authored Nov 2, 2023
1 parent a17467e commit ce2bc58
Show file tree
Hide file tree
Showing 24 changed files with 283 additions and 285 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@

'use strict';

let Activity;
let React = require('react');
let ReactDOM;
let ReactDOMClient;
let ReactDOMServer;
let Scheduler;
let ReactFeatureFlags;
let Scheduler;
let Suspense;
let SuspenseList;
let Offscreen;
let useSyncExternalStore;
let act;
let IdleEventPriority;
Expand Down Expand Up @@ -112,8 +112,8 @@ describe('ReactDOMServerPartialHydration', () => {
act = require('internal-test-utils').act;
ReactDOMServer = require('react-dom/server');
Scheduler = require('scheduler');
Activity = React.unstable_Activity;
Suspense = React.Suspense;
Offscreen = React.unstable_Offscreen;
useSyncExternalStore = React.useSyncExternalStore;
if (gate(flags => flags.enableSuspenseList)) {
SuspenseList = React.unstable_SuspenseList;
Expand Down Expand Up @@ -778,7 +778,7 @@ describe('ReactDOMServerPartialHydration', () => {
expect(span).not.toBe(span2);

if (gate(flags => flags.dfsEffectsRefactor)) {
// The effects list refactor causes this to be null because the Suspense Offscreen's child
// The effects list refactor causes this to be null because the Suspense Activity's child
// is null. However, since we can't hydrate Suspense in legacy this change in behavior is ok
expect(ref.current).toBe(null);
} else {
Expand Down Expand Up @@ -3151,15 +3151,15 @@ describe('ReactDOMServerPartialHydration', () => {
expect(ref.current.innerHTML).toBe('Hidden child');
});

// @gate enableOffscreen
it('a visible Offscreen component acts like a fragment', async () => {
// @gate enableActivity
it('a visible Activity component acts like a fragment', async () => {
const ref = React.createRef();

function App() {
return (
<Offscreen mode="visible">
<Activity mode="visible">
<span ref={ref}>Child</span>
</Offscreen>
</Activity>
);
}

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

// Visible Offscreen boundaries behave exactly like fragments: a
// Visible Activity boundaries behave exactly like fragments: a
// pure indirection.
expect(container).toMatchInlineSnapshot(`
<div>
Expand All @@ -3187,8 +3187,8 @@ describe('ReactDOMServerPartialHydration', () => {
expect(ref.current).toBe(span);
});

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

function HiddenChild() {
Expand All @@ -3201,9 +3201,9 @@ describe('ReactDOMServerPartialHydration', () => {
return (
<>
<span ref={visibleRef}>Visible</span>
<Offscreen mode="hidden">
<Activity mode="hidden">
<HiddenChild />
</Offscreen>
</Activity>
</>
);
}
Expand Down
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiber.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import type {SuspenseInstance} from './ReactFiberConfig';
import type {
OffscreenProps,
OffscreenInstance,
} from './ReactFiberOffscreenComponent';
} from './ReactFiberActivityComponent';
import type {TracingMarkerInstance} from './ReactFiberTracingMarkerComponent';

import {
Expand Down Expand Up @@ -71,7 +71,7 @@ import {
CacheComponent,
TracingMarkerComponent,
} from './ReactWorkTags';
import {OffscreenVisible} from './ReactFiberOffscreenComponent';
import {OffscreenVisible} from './ReactFiberActivityComponent';
import getComponentNameFromFiber from 'react-reconciler/src/getComponentNameFromFiber';
import {isDevToolsPresent} from './ReactFiberDevToolsHook';
import {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiberBeginWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ import type {
OffscreenState,
OffscreenQueue,
OffscreenInstance,
} from './ReactFiberOffscreenComponent';
import {OffscreenDetached} from './ReactFiberOffscreenComponent';
} from './ReactFiberActivityComponent';
import {OffscreenDetached} from './ReactFiberActivityComponent';
import type {
Cache,
CacheComponentState,
Expand Down
6 changes: 3 additions & 3 deletions packages/react-reconciler/src/ReactFiberCommitWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@ import type {SuspenseState, RetryQueue} from './ReactFiberSuspenseComponent';
import type {UpdateQueue} from './ReactFiberClassUpdateQueue';
import type {FunctionComponentUpdateQueue} from './ReactFiberHooks';
import type {Wakeable} from 'shared/ReactTypes';
import {isOffscreenManual} from './ReactFiberOffscreenComponent';
import {isOffscreenManual} from './ReactFiberActivityComponent';
import type {
OffscreenState,
OffscreenInstance,
OffscreenQueue,
OffscreenProps,
} from './ReactFiberOffscreenComponent';
} from './ReactFiberActivityComponent';
import type {HookFlags} from './ReactHookEffectTags';
import type {Cache} from './ReactFiberCacheComponent';
import type {RootState} from './ReactFiberRoot';
Expand Down Expand Up @@ -209,7 +209,7 @@ import {
OffscreenVisible,
OffscreenDetached,
OffscreenPassiveEffectsConnected,
} from './ReactFiberOffscreenComponent';
} from './ReactFiberActivityComponent';
import {
TransitionRoot,
TransitionTracingMarker,
Expand Down
8 changes: 5 additions & 3 deletions packages/react-reconciler/src/ReactFiberCompleteWork.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ import type {
SuspenseListRenderState,
RetryQueue,
} from './ReactFiberSuspenseComponent';
import type {OffscreenQueue} from './ReactFiberOffscreenComponent';
import {isOffscreenManual} from './ReactFiberOffscreenComponent';
import type {OffscreenState} from './ReactFiberOffscreenComponent';
import type {
OffscreenState,
OffscreenQueue,
} from './ReactFiberActivityComponent';
import {isOffscreenManual} from './ReactFiberActivityComponent';
import type {TracingMarkerInstance} from './ReactFiberTracingMarkerComponent';
import type {Cache} from './ReactFiberCacheComponent';
import {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-reconciler/src/ReactFiberConcurrentUpdates.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import type {
Update as ClassUpdate,
} from './ReactFiberClassUpdateQueue';
import type {Lane, Lanes} from './ReactFiberLane';
import type {OffscreenInstance} from './ReactFiberOffscreenComponent';
import type {OffscreenInstance} from './ReactFiberActivityComponent';

import {
warnAboutUpdateOnNotYetMountedFiberInDEV,
Expand All @@ -27,7 +27,7 @@ import {
import {NoLane, NoLanes, mergeLanes, markHiddenUpdate} from './ReactFiberLane';
import {NoFlags, Placement, Hydrating} from './ReactFiberFlags';
import {HostRoot, OffscreenComponent} from './ReactWorkTags';
import {OffscreenVisible} from './ReactFiberOffscreenComponent';
import {OffscreenVisible} from './ReactFiberActivityComponent';

export type ConcurrentUpdate = {
next: ConcurrentUpdate,
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberSuspenseContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import type {Fiber} from './ReactInternalTypes';
import type {StackCursor} from './ReactFiberStack';
import type {SuspenseProps, SuspenseState} from './ReactFiberSuspenseComponent';
import type {OffscreenState} from './ReactFiberOffscreenComponent';
import type {OffscreenState} from './ReactFiberActivityComponent';

import {enableSuspenseAvoidThisFallback} from 'shared/ReactFeatureFlags';
import {createCursor, push, pop} from './ReactFiberStack';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberThrow.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {Lane, Lanes} from './ReactFiberLane';
import type {CapturedValue} from './ReactCapturedValue';
import type {Update} from './ReactFiberClassUpdateQueue';
import type {Wakeable} from 'shared/ReactTypes';
import type {OffscreenQueue} from './ReactFiberOffscreenComponent';
import type {OffscreenQueue} from './ReactFiberActivityComponent';
import type {RetryQueue} from './ReactFiberSuspenseComponent';

import getComponentNameFromFiber from 'react-reconciler/src/getComponentNameFromFiber';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type {
Fiber,
FiberRoot,
} from './ReactInternalTypes';
import type {OffscreenInstance} from './ReactFiberOffscreenComponent';
import type {OffscreenInstance} from './ReactFiberActivityComponent';
import type {StackCursor} from './ReactFiberStack';

import {enableTransitionTracing} from 'shared/ReactFeatureFlags';
Expand Down
2 changes: 1 addition & 1 deletion packages/react-reconciler/src/ReactFiberWorkLoop.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import type {
Transition,
TransitionAbort,
} from './ReactFiberTracingMarkerComponent';
import type {OffscreenInstance} from './ReactFiberOffscreenComponent';
import type {OffscreenInstance} from './ReactFiberActivityComponent';
import type {RenderTaskFn} from './ReactFiberRootScheduler';

import {
Expand Down
Loading

0 comments on commit ce2bc58

Please sign in to comment.