-
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
Improve deprecation warnings by more info and links #9768
Improve deprecation warnings by more info and links #9768
Conversation
**what is the change?:** Updates the warnings for - - `React.createMixin` (was never implemented!) - `React.PropTypes` - `React.createClass` - `React.DOM.*` We never added the warning for `React.createClass` to the 15.5 line, so a follow-up PR will add that, with a link to docs etc. Does *not* update the older warnings for - - Factory.type - 'isMounted' and 'replaceState' - ReactPerf We could do a second pass if we want to improve those three warnings, but for now I don't think they are as hi-pri. Still TODO: - Do an initial release of the [`react-addons-dom-factories`](https://github.com/facebook/react/tree/master/packages/react-dom-factories#react-addons-dom-factories) package on npm, making it 1.0. - Improve the docs for `react-addons-dom-factories` adding documentation and mention the [codemod](https://github.com/reactjs/react-codemod/blob/master/transforms/React-DOM-to-react-dom-factories.js) **why make this change?:** - We want to make updating as easy as possible. Warning messages should increase clarity, and in the past they have caused confusion. **test plan:** `yarn test` and running these messages past some folks who use React. **issue:** facebook#9398
src/isomorphic/React.js
Outdated
'can use this mixin directly instead.', | ||
'In React 16.0, React.createMixin is deprecated and should not be used. ' + | ||
'You can use this mixin directly instead.' + | ||
' See (https://fb.me/createmixin-was-never-implemented) for more info.', |
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.
intentional that this is in parens?
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.
Yea, but looking at it again I don't think we need the parens. Will fix, thanks for pointing it out. :)
src/isomorphic/React.js
Outdated
@@ -109,8 +110,11 @@ if (__DEV__) { | |||
get() { | |||
lowPriorityWarning( | |||
didWarnPropTypesDeprecated, | |||
'Accessing PropTypes via the main React package is deprecated. Use ' + | |||
'the prop-types package from npm instead.', | |||
'In React v16.0+, accessing PropTypes via the main React package is deprecated. Use ' + |
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.
Isn't this implying it got deprecated in 16 but will be removed later? Usually we say something is deprecated in the current cycle and removed (or moved) in the next cycle. Otherwise it seems like we have not deprecated it yet (but we did).
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.
We could rephrase "In React 16.0+, accessing PropTypes from React package will no longer work. [...]" Then in my opinion it's clearer what will happen and when.
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.
ahhhh yes good catch. sorry I missed that. should say like:
Accessing PropTypes via the main React package is deprecated. In React v16.0, it will be removed completely. Use the …
edit: or dan's wording
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.
Sounds good! Will fix.
**what is the change?:** We rephrased the deprecation messages to clarify that - these APIs are currently deprecated - they will be removed in React v16.0 The previous wording implied that they would be deprecated in v16.0. **why make this change?:** To make the messages easier to understand. **test plan:** Visual inspection
1aa0bad
to
404772e
Compare
Note to self - cherry-pick this on to master. |
'and will be removed in the future. Use the ' + | ||
'react-addons-dom-factories package instead.', | ||
'and will be removed in v16.0+. Use the ' + | ||
'react-addons-dom-factories package instead. ' + |
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.
I don't think this matches the package name.
https://github.com/facebook/react/tree/master/packages/react-dom-factories
We should probably avoid calling it an "addon" since it was never exposed on React.addons
.
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.
Thanks - going to do an overall clean-up of that. The README in that package has the wrong name, and probably other places too.
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.
Please update the gist too when you do it (since it also references the package name).
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.
You mean the fb.me url and the README.md
which it points to? Yes.
* Improve deprecation warnings by more info and links **what is the change?:** Updates the warnings for - - `React.createMixin` (was never implemented!) - `React.PropTypes` - `React.createClass` - `React.DOM.*` We never added the warning for `React.createClass` to the 15.5 line, so a follow-up PR will add that, with a link to docs etc. Does *not* update the older warnings for - - Factory.type - 'isMounted' and 'replaceState' - ReactPerf We could do a second pass if we want to improve those three warnings, but for now I don't think they are as hi-pri. Still TODO: - Do an initial release of the [`react-addons-dom-factories`](https://github.com/facebook/react/tree/master/packages/react-dom-factories#react-addons-dom-factories) package on npm, making it 1.0. - Improve the docs for `react-addons-dom-factories` adding documentation and mention the [codemod](https://github.com/reactjs/react-codemod/blob/master/transforms/React-DOM-to-react-dom-factories.js) **why make this change?:** - We want to make updating as easy as possible. Warning messages should increase clarity, and in the past they have caused confusion. **test plan:** `yarn test` and running these messages past some folks who use React. **issue:** facebook#9398 * Rephrase deprecation messages for clarity **what is the change?:** We rephrased the deprecation messages to clarify that - these APIs are currently deprecated - they will be removed in React v16.0 The previous wording implied that they would be deprecated in v16.0. **why make this change?:** To make the messages easier to understand. **test plan:** Visual inspection
Not sure who to tag for review, but this and adding the warnings for
React.createClass
should be the last two things blocking the 15.6RC. So anyone who wants to unblock by reviewing feel free~ 🚀what is the change?:
Updates the warnings for -
React.createMixin
(was never implemented!)React.PropTypes
React.DOM.*
I think we never added the warning for
React.createClass
to the 15.5 line, unless I'm missing it, soa follow-up PR will add that, with a link to docs etc.
Does not update the older warnings for -
We could do a second pass if we want to improve those three warnings, but for now I don't think they are as hi-pri.
Still TODO:
react-addons-dom-factories
package on npm, making it 1.0.react-addons-dom-factories
adding documentation and mention the codemodwhy make this change?:
test plan:
yarn test
and running these messages past some folks who use React.issue:
#9398