-
Notifications
You must be signed in to change notification settings - Fork 47k
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
Deduplicate "unknown prop" warning to ease pain of version updates #9488
Deduplicate "unknown prop" warning to ease pain of version updates #9488
Conversation
Some widely used libraries which depend on React have used syntax that ends up passing non-standard props to default React components like 'dom' and 'div'. For example: ``` // where this.props contains attributes like 'foo' return <div {...this.props} />; ``` Since we started throwing warnings for this syntax in Reactv15.2 some libraries have not upgraded past v15.2. Now, because of deprecations in 15.5, some libraries will only work with Reactv15.5, and this causes a conflict when other libraries are pinned at v15.1. The overall effect is that either there are version conflicts or the "unknown prop" warning is thrown all over the place, and users of these libraries can't fix the warnings. See facebook#9466 for more context. We are deduping this warning in hopes that it allows more library authors to update to the latest version of React. React v16.0 may take a different approach to this issue. For some related discussion, see facebook#9477 **Test Plan:** - Added a unit test - Manually tested with a fixture that was not committed; https://gist.github.com/flarnie/db011bf54206f30b9983cd4dc674c82e
Does this mean that if a third-party component warns first, then you'll never see any warnings for first-party code? |
Yea. IMO at this point it’s a reasonable tradeoff (most third party libs have updated long ago). |
Yea - there are definitely trade-offs with this approach. It sounds like there was some discussion on Twitter, and then on the issue as well. I think this is okayish for v15.6, but we may want to discuss more how to deal with this in v16.0. |
IMO we should completely switch to the new behavior in 16.0 (#9477). Then we won't need to come back to this warning at all. |
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.
LGTM, thanks!
Closing per discussion with @flarnie and #9466 (comment). |
Note: There are other PRs open to fix some failing tests and I expect to rebase on top of those and fix any remaining failures before landing. Hope folks can review this anyway in light of this.
Some widely used libraries which depend on React have used syntax that
ends up passing non-standard props to default React components like
'dom' and 'div'. For example:
Since we started throwing warnings for this syntax in Reactv15.2 some
libraries have not upgraded past v15.2.
Now, because of deprecations in 15.5, some libraries will only work with
Reactv15.5, and this causes a conflict when other libraries are pinned
at v15.1. The overall effect is that either there are version conflicts
or the "unknown prop" warning is thrown all over the place, and users of
these libraries can't fix the warnings.
See #9466 for more context.
We are deduping this warning in hopes that it allows more library
authors to update to the latest version of React. React v16.0 may take a
different approach to this issue. For some related discussion, see
#9477
Test Plan:
Before submitting a pull request, please make sure the following is done:
master
.npm test
).npm run lint
).npm run prettier
).npm run flow
)../scripts/fiber/record-tests
before submitting the pull request, and commit the resulting changes.