-
Notifications
You must be signed in to change notification settings - Fork 47.2k
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
Remove useMutationEffect #14336
Remove useMutationEffect #14336
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Guess I'm going to need to update the Flow types again
sorry @kentcdodds |
Haha, I'll update my blogpost :D |
ReactDOM: size: 0.0%, gzip: 0.0% Details of bundled changes.Comparing: 48f1e5b...708c60a react-dom
Generated by 🚫 dangerJS |
useMutationEffect has problems (namely, refs aren't attached at the time that it runs) and we're not positive it's necessary. useLayoutEffect runs at the same time as componentDidMount/Update so it's sufficient for all existing use cases; it can be used in any case that useEffect happens too late. Until we figure out what we want to do, let's delete it.
BREAKING CHANGE: `useContextMutationEffect` has been removed. `React.useMutationEffect` will be removed from React hooks, so this is just to reflect that (see facebook/react#14336).
Maybe we can also update docs here. Code snippet explaining how to read an often-changing value from useCallback used this hook which is no longer available. |
That exact link has already been updated. |
Summary: Resolves #7219 - [x] 2fdcda5: Removed `React.useMutationEffect` hook (facebook/react/pull/14336) and updated tests. This hook was only ever exposed in an alpha release of 16.7 and so it should be safe to remove in a non-backwards-compatible way. - [x] dabf49e: Add `React.Suspense` component and tests. (No final public documentation exists for `Suspense` yet– although we're working on it. For the time being, [tests like this](https://github.com/facebook/react/blob/master/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js) can serve as a reference.) - [x] 8df05bd: Fixed invalid `useCallback` definition and tests. - [x] 063b022: Fixed invalid `React.lazy` signature to reflect that a `Promise` with a "default" property should be returned (rather than a React component). Pull Request resolved: #7213 Reviewed By: jbrown215 Differential Revision: D13222880 Pulled By: bvaughn fbshipit-source-id: 77e59e320698567c343c91a67b3aa91e9c925873
Summary: Resolves #7219 - [x] 2fdcda5: Removed `React.useMutationEffect` hook (facebook/react/pull/14336) and updated tests. This hook was only ever exposed in an alpha release of 16.7 and so it should be safe to remove in a non-backwards-compatible way. - [x] dabf49e: Add `React.Suspense` component and tests. (No final public documentation exists for `Suspense` yet– although we're working on it. For the time being, [tests like this](https://github.com/facebook/react/blob/master/packages/react-reconciler/src/__tests__/ReactSuspense-test.internal.js) can serve as a reference.) - [x] 8df05bd: Fixed invalid `useCallback` definition and tests. - [x] 063b022: Fixed invalid `React.lazy` signature to reflect that a `Promise` with a "default" property should be returned (rather than a React component). Pull Request resolved: #7213 Reviewed By: jbrown215 Differential Revision: D13222880 Pulled By: bvaughn fbshipit-source-id: 9e1b48ace984051928c4ab92fa61182ad70f7119
Also, I was **not** testing for them, so... Related: facebook/react#14336
Someone asked the above question (but I guess it was deleted before I had a chance to respond?) Anyway, in case someone else comes across this PR and wonders the same– it seemed worth re-emphasizing what Sophie said in the PR description:
Updating the above repro to use |
useMutationEffect has problems (namely, refs aren't attached at the time that it runs) and we're not positive it's necessary. useLayoutEffect runs at the same time as componentDidMount/Update so it's sufficient for all existing use cases; it can be used in any case that useEffect happens too late. Until we figure out what we want to do, let's delete it.
useMutationEffect has problems (namely, refs aren't attached at the time that it runs) and we're not positive it's necessary. useLayoutEffect runs at the same time as componentDidMount/Update so it's sufficient for all existing use cases; it can be used in any case that useEffect happens too late. Until we figure out what we want to do, let's delete it.
useMutationEffect has problems (namely, refs aren't attached at the time that it runs) and we're not positive it's necessary. useLayoutEffect runs at the same time as componentDidMount/Update so it's sufficient for all existing use cases; it can be used in any case that useEffect happens too late. Until we figure out what we want to do, let's delete it.