-
Notifications
You must be signed in to change notification settings - Fork 10.3k
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
Using <StrictMode /> causes error in console: Warning: Unsafe lifecycle methods were found within a strict-mode tree
#10179
Comments
That's because and i'm just guessing, as i'm not knowledgeable of all the gatsby code, but deep down somewhere in some components used in gatsby, or one of the libraries you're using, there might be some now deprecated methods being used. And correcting that might take some time as the React ecosystem is constantly evolving and not only gatsby, but other libraries also, will take some time to adjust to this constant evolution. |
I hadn't tried to build for prod with yet, it warns in develop only. |
I'm inclined to say that this will happen in production mode as well. |
It is warning, not an error, so yes it does not crush an app by itself, but if you have scripts, which tracking errors, it spams a system with false negatives, and google lighthouse audit tool lowers your performance grade. Console.log is not cheap IO operation, especially with warnings. |
@JustFly1984 i'm going to cc this issue to two people more knowledgeable of the library so that they are made aware of the issue if you don't mind. |
Actually that's not entirely true - it shows "stack trace" which originates from gatsby runtime, but actually end up in your code:
Do You perhaps use https://github.com/gaearon/react-side-effect ? (or maybe some of your dependencies use it) |
Nope, I was using static gDPFS, not WillMount. I do not have willMount in my code, cos I did refactor it since long time ago, and search across project proves it. @pieh id you can se the stack trace starts in StrictMode and bubbles (unwraps) from the button to the top the component tree, so the strict mode is the root element of IndexPage, and after that it is gatsby's code till AppContainer and HotExported_default, which is react-hot-reload's code, and errors out exactly react-hot-loader
|
I did some quick investigation with default starter and in this case it seems like We don't use |
Thank you, this explain some stuff, I'm pretty sure it will be fixed by Dan asap |
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
not stale |
Hey again! It’s been 30 days since anything happened on this issue, so our friendly neighborhood robot (that’s me!) is going to close it. Please keep in mind that I’m only a robot, so if I’ve closed this issue in error, I’m Thanks again for being part of the Gatsby community! |
Please reopen |
I'm getting the following error with
It seems that
Related:
|
Hiya! This issue has gone quiet. Spooky quiet. 👻 We get a lot of issues, so we currently close issues after 30 days of inactivity. It’s been at least 20 days since the last update here. If we missed this issue or if you want to keep it open, please reply here. You can also add the label "not stale" to keep this issue open! Thanks for being a part of the Gatsby community! 💪💜 |
not stale |
One option would be to use react-helmet-async as an alternative to react-helmet. |
How to deprecate If for example somebody imports helmet from sub-dependencies gatsby, it could break the build. This looks like breaking change issue. |
This issue will now hit a lot more consumers, due to React 16.9. |
Yes, this bummers me to update react in my gatsby project |
Has anybody looked into using react-helmet-async as a replacement? This article by the creator cites the lack of activity at react-helmet as a major motivation for a fork: https://open.nytimes.com/the-future-of-meta-tag-management-for-modern-react-development-ec26a7dc9183 At this point react-helmet-async has as many weekly downloads as react-helmet. |
@Sever1an thank you for taking the time to write such a comprehensive post. Sadly we're not able to move away from react-helmet in v2 as it would be a breaking change with gatsby-plugin-react-helmet. What's the reason to use StrictMode? |
underline this, no??
Hope you can do this now - just think of all the time we spend tracking this down...and the support load for other systems or benefitting by upgrading Gatsby - thanks |
It's hard to tell what the rationale is from this thread. I tried using |
@Sever1an out of curiosity, why are we not open to a breaking change to fix this issue? i took a look at several other plugins in the repo, and as of now they are not all synchronized on major versions, so that reason seems unlikely. |
@wardpeet Would it be possible to add this to the milestone for the next major version? |
Seems like parts of the community is already opting for gatsby-plugin-react-helmet-async. To move forward with this issue, maybe we could update the docs, switch the default meta tag manager in the official Gatsby starters... and eventually deprecate |
The async helmet plugin should be official, not community contributed. react-helmet is vaporware |
This problem has been fixed by the release of React Helmet v6. To update your site:
|
As @m-allanson pointed out, react-helmet has released a new release fixing this issue. I think this issue is now OK to be closed |
@simnalamburt closing |
@m-allanson but it wasn't fixed? Getting
with react-helmet 6.1.0 and gatsby-plugin-react-helmet 4.14.0. See nfl/react-helmet#548 and the comments on nfl/react-helmet#426 (after it was closed). Helmet still depends on react-side-effect, which still uses |
I'm using gatsby as example environment for new google maps api, and I need to test it with SSR, but at the same time I need to test it in strict mode, but instead of showing me errors in my own code, it errors out on
gatsby's
code.The text was updated successfully, but these errors were encountered: