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

Upgrade useInsertionEffect to stable #22589

Merged
merged 1 commit into from
Oct 19, 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
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,8 @@ describe('ReactHooksInspectionIntegration', () => {
]);
});

// @gate experimental || www
it('should inspect the current state of all stateful hooks, including useInsertionEffect', () => {
const useInsertionEffect = React.unstable_useInsertionEffect;
const useInsertionEffect = React.useInsertionEffect;
const outsideRef = React.createRef();
function effect() {}
function Foo(props) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function initModules() {
useRef = React.useRef;
useDebugValue = React.useDebugValue;
useImperativeHandle = React.useImperativeHandle;
useInsertionEffect = React.unstable_useInsertionEffect;
useInsertionEffect = React.useInsertionEffect;
useLayoutEffect = React.useLayoutEffect;
useOpaqueIdentifier = React.unstable_useOpaqueIdentifier;
forwardRef = React.forwardRef;
Expand Down Expand Up @@ -641,7 +641,6 @@ describe('ReactDOMServerHooks', () => {
});
});
describe('useInsertionEffect', () => {
// @gate experimental || www
it('should warn when invoked during render', async () => {
function Counter() {
useInsertionEffect(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('ReactHooksWithNoopRenderer', () => {
useState = React.useState;
useReducer = React.useReducer;
useEffect = React.useEffect;
useInsertionEffect = React.unstable_useInsertionEffect;
useInsertionEffect = React.useInsertionEffect;
useLayoutEffect = React.useLayoutEffect;
useCallback = React.useCallback;
useMemo = React.useMemo;
Expand Down Expand Up @@ -2685,7 +2685,6 @@ describe('ReactHooksWithNoopRenderer', () => {
});

describe('useInsertionEffect', () => {
// @gate experimental || www
it('fires insertion effects after snapshots on update', () => {
function CounterA(props) {
useInsertionEffect(() => {
Expand Down Expand Up @@ -2745,7 +2744,6 @@ describe('ReactHooksWithNoopRenderer', () => {
});
});

// @gate experimental || www
it('fires insertion effects before layout effects', () => {
let committedText = '(empty)';

Expand Down Expand Up @@ -2808,7 +2806,6 @@ describe('ReactHooksWithNoopRenderer', () => {
expect(Scheduler).toHaveYielded(['Destroy passive [current: 0]']);
});

// @gate experimental || www
it('force flushes passive effects before firing new insertion effects', () => {
let committedText = '(empty)';

Expand Down Expand Up @@ -2876,7 +2873,6 @@ describe('ReactHooksWithNoopRenderer', () => {
]);
});

// @gate experimental || www
it('fires all insertion effects (interleaved) before firing any layout effects', () => {
let committedA = '(empty)';
let committedB = '(empty)';
Expand Down Expand Up @@ -3043,7 +3039,6 @@ describe('ReactHooksWithNoopRenderer', () => {
});
});

// @gate experimental || www
it('assumes insertion effect destroy function is either a function or undefined', () => {
function App(props) {
useInsertionEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion packages/react/index.classic.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export {
useEffect,
useImperativeHandle,
useLayoutEffect,
unstable_useInsertionEffect,
useInsertionEffect,
useMemo,
useMutableSource,
useMutableSource as unstable_useMutableSource,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/index.experimental.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export {
useDeferredValue,
useEffect,
useImperativeHandle,
unstable_useInsertionEffect,
useInsertionEffect,
useLayoutEffect,
useMemo,
useMutableSource as unstable_useMutableSource,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export {
useDeferredValue,
useEffect,
useImperativeHandle,
unstable_useInsertionEffect,
useInsertionEffect,
useLayoutEffect,
useMemo,
useMutableSource,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/index.modern.fb.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export {
useDeferredValue as unstable_useDeferredValue, // TODO: Remove once call sights updated to useDeferredValue
useEffect,
useImperativeHandle,
unstable_useInsertionEffect,
useInsertionEffect,
useLayoutEffect,
useMemo,
useMutableSource,
Expand Down
1 change: 1 addition & 0 deletions packages/react/index.stable.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export {
useDeferredValue,
useEffect,
useImperativeHandle,
useInsertionEffect,
useLayoutEffect,
useMemo,
useMutableSource as unstable_useMutableSource,
Expand Down
2 changes: 1 addition & 1 deletion packages/react/src/React.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ export {
useEffect,
useImperativeHandle,
useDebugValue,
useInsertionEffect as unstable_useInsertionEffect,
useInsertionEffect,
useLayoutEffect,
useMemo,
useMutableSource,
Expand Down