-
Notifications
You must be signed in to change notification settings - Fork 651
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
StrictMode warning for findDOMNode and legacy context API in Transition as of React 16.6 #429
Comments
Thanks! I wouldn't consider this a bug since it's a deprecation warning but we'll do what we can to use refs if feasible |
Please can this be reopened until it's fixed? :-) The warning makes using |
This warning has now stopped transitions from working in strict mode, not just showing in the console but continuing to operate. So it makes it difficult or impossible to add new animations without turning off strict mode on local environments. react: v16.6.3 |
The warning can't stop transition s it's just a console.log not a thrown error |
It might be something else but we noticed the transitions weren't firing and then when we turned off strict mode it started animating properly again, so seems like something is getting stopped up related to it |
StrictMode doesn't only print warnings, it also double-renders all components in development. |
@Kovensky Ohh okay, good to know, that must be what's causing the issue then. Thank you! I learned something new today haha |
Is there any progress here? It's really painful to work with console in |
I haven't been able to wrap my head around all the considerations this lib takes, but to move the conversation forward: 1) Are there any specific challenges to use the new context api?From what I could gather by browsing the source code, maybe it could cause problems for nested transitions? (https://github.com/reactjs/react-transition-group/blob/master/src/Transition.js#L150) The Transition would have to consume the context via a render callback, so maybe we could just wrap the exported component so that it would receive
Are there performance considerations I'm missing? Backwards compatibility with React 15? 2) Are there any specific challenges to use refs in this case?I couldn't spot anything right now. |
This pull request should fix the |
`[email protected]` allows usage of static `contextType`. With `16.0.0` we would need a higher-order component that puts the context value into props since `Transition` needs to have access to the context in its constructor. Partial fix for #429 BREAKING CHANGE: use new style react context ```diff // package.json -"react": "^15.0.0", +"react": "^16.6.0", -"react-dom": "^15.0.0", +"react-dom": "^16.6.0", ```
# [3.0.0](v2.9.0...v3.0.0) (2019-04-15) ### Features * use stable context API ([#471](#471)) ([aee4901](aee4901)), closes [#429](#429) ### BREAKING CHANGES * use new style react context ```diff // package.json -"react": "^15.0.0", +"react": "^16.6.0", -"react-dom": "^15.0.0", +"react-dom": "^16.6.0", ```
@jquense Can you close this issue? |
There is still the findDOMNode issue and using ForwardRef would cause a breaking change, nonetheless React.ConcurrentMode will require it. |
Is there any progress here after one year? It's still really painful see these errors in |
#514 might be a could transitional solution, please consider it :) |
Is there any progress here? It's still really painful see these errors in |
For those annoyed by the warning in strict mode. If you don't use the newest React features you could lower the React version to 16.5. The warning is introduced in version 16.6. |
We're looking for a workaround for this, feel free to voice your opinions in the RFC: #606 |
🎉 This issue has been resolved in version 4.4.0 🎉 The release is available on: Your semantic-release bot 📦🚀 |
Seems the issue may still be present with I do have
|
@alecmarcus Are you using the the new Short write up about this prop in the CHANGELOG |
@pmoons Wonderful, that was it (my bad for not reading). Thanks for the help! |
I appreciate the work that has been done on this package, but this issue should not be closed. After upgrading to 4.4.1 I still get the warning when I enable strict mode. I saw the changelog entry that explains the workaround of passing a nodeRef prop. However, the default behaviour of this package still produces the warning in strict mode and hence this issue is not technically resolved, only a workaround has been provided. |
It's not a workaround, you have to explicitly assign a node to react-transition-group, otherwise it cannot avoid using We would've loved to solve this without people having to update their code, but it's just not possible. |
I think the documentation should be updated, too. |
They are most probably using the outdated version of react-transition-group, so you have no control over that. I wouldn't suggest for them to upgrade yet, though, we complete the roadmap described in #630. Regarding the documentation, please describe what specifically you believe needs to be updated in a new issue. |
Do you want to request a feature or report a bug?
Report a bug
What is the current behavior?
When using
<Transition />
inside of<React.StrictMode />
, warnings are logged aboutfindDOMNode
and the legacy context API (as of React 16.6)If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem via CodeSandbox.
View the console at https://codesandbox.io/s/y0r3kl6x1j. On mount, you'll see:
and after clicking "Toggle in Prop", you'll see:
What is the expected behavior?
No warning should be logged.
Which versions, and which browser / OS are affected by this issue? Did this work in previous versions?
These warnings are new as of React 16.6.
The text was updated successfully, but these errors were encountered: