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

Improve deprecation warnings by more info and links #9768

Merged

Conversation

flarnie
Copy link
Contributor

@flarnie flarnie commented May 24, 2017

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, 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 package on npm, making it 1.0.
  • Improve the docs for react-addons-dom-factories adding documentation and mention the codemod

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:
#9398

**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
@flarnie flarnie added this to the 15.6 milestone May 24, 2017
'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.',
Copy link
Collaborator

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?

Copy link
Contributor Author

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. :)

@@ -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 ' +
Copy link
Collaborator

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).

Copy link
Collaborator

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.

Copy link
Collaborator

@sophiebits sophiebits May 24, 2017

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

Copy link
Contributor Author

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
@flarnie flarnie force-pushed the improveDeprecationWarningsAndAddLink branch from 1aa0bad to 404772e Compare May 25, 2017 14:20
@flarnie flarnie merged commit 3f62cd5 into facebook:15.6-dev May 25, 2017
@flarnie
Copy link
Contributor Author

flarnie commented May 25, 2017

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. ' +
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

Copy link
Collaborator

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).

Copy link
Contributor Author

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.

@flarnie flarnie mentioned this pull request May 25, 2017
49 tasks
flarnie added a commit to flarnie/react that referenced this pull request Jun 7, 2017
* 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
@flarnie flarnie deleted the improveDeprecationWarningsAndAddLink branch May 25, 2018 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants