Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Delete test-utils implementation of act #21703

Merged
merged 2 commits into from
Jun 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
10 changes: 5 additions & 5 deletions packages/react-dom/src/client/ReactDOM.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ import {
flushSync,
flushControlled,
injectIntoDevTools,
flushPassiveEffects,
IsThisRendererActing,
act,
attemptSynchronousHydration,
attemptDiscreteHydration,
attemptContinuousHydration,
Expand Down Expand Up @@ -155,18 +155,18 @@ function renderSubtreeIntoContainer(
}

const Internals = {
// Keep in sync with ReactTestUtils.js, and ReactTestUtilsAct.js.
// Keep in sync with ReactTestUtils.js.
// This is an array for better minification.
Events: [
getInstanceFromNode,
getNodeFromInstance,
getFiberCurrentPropsFromNode,
enqueueStateRestore,
restoreStateIfNeeded,
flushPassiveEffects,
// TODO: This is related to `act`, not events. Move to separate key?
IsThisRendererActing,
],
act,
// TODO: Temporary. Only used by our internal version of `act. Will remove.
IsThisRendererActing,
};

export {
Expand Down
13 changes: 6 additions & 7 deletions packages/react-dom/src/test-utils/ReactTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,24 @@ import {
import {SyntheticEvent} from '../events/SyntheticEvent';
import invariant from 'shared/invariant';
import {ELEMENT_NODE} from '../shared/HTMLNodeType';
import {act} from './ReactTestUtilsPublicAct';
import {unstable_concurrentAct} from './ReactTestUtilsInternalAct';
import {
rethrowCaughtError,
invokeGuardedCallbackAndCatchFirstError,
} from 'shared/ReactErrorUtils';
import isArray from 'shared/isArray';

// Keep in sync with ReactDOM.js, and ReactTestUtilsAct.js:
const EventInternals =
ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
// Keep in sync with ReactDOM.js:
const SecretInternals =
ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
const EventInternals = SecretInternals.Events;
const getInstanceFromNode = EventInternals[0];
const getNodeFromInstance = EventInternals[1];
const getFiberCurrentPropsFromNode = EventInternals[2];
const enqueueStateRestore = EventInternals[3];
const restoreStateIfNeeded = EventInternals[4];
// const flushPassiveEffects = EventInternals[5];
// TODO: This is related to `act`, not events. Move to separate key?
// const IsThisRendererActing = EventInternals[6];

const act = SecretInternals.act;

function Event(suffix) {}

Expand Down
13 changes: 3 additions & 10 deletions packages/react-dom/src/test-utils/ReactTestUtilsInternalAct.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,9 @@ import ReactSharedInternals from 'shared/ReactSharedInternals';
import enqueueTask from 'shared/enqueueTask';
import * as Scheduler from 'scheduler';

// Keep in sync with ReactDOM.js, and ReactTestUtils.js:
const EventInternals =
ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.Events;
// const getInstanceFromNode = EventInternals[0];
// const getNodeFromInstance = EventInternals[1];
// const getFiberCurrentPropsFromNode = EventInternals[2];
// const enqueueStateRestore = EventInternals[3];
// const restoreStateIfNeeded = EventInternals[4];
// const flushPassiveEffects = EventInternals[5];
const IsThisRendererActing = EventInternals[6];
const SecretInternals =
ReactDOM.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
const IsThisRendererActing = SecretInternals.IsThisRendererActing;

const batchedUpdates = ReactDOM.unstable_batchedUpdates;

Expand Down
214 changes: 0 additions & 214 deletions packages/react-dom/src/test-utils/ReactTestUtilsPublicAct.js

This file was deleted.