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

How does one disable the big red warning message? #1458

Closed
iambumblehead opened this issue Mar 15, 2019 · 9 comments
Closed

How does one disable the big red warning message? #1458

iambumblehead opened this issue Mar 15, 2019 · 9 comments

Comments

@iambumblehead
Copy link
Contributor

I've updated inferno and redux in an application using react-toastify. Because react-toastify uses 'legacy' lifecycle functions, inferno prints the following red message to the console,

Warning: Unsafe legacy lifecycles will not be called for components using new component APIs.
      TransitionGroup contains the following legacy lifecycles:
      componentWillMount
componentWillReceiveProps
      The above lifecycles should be removed.

Is it safe to use inferno with react-toastify? If so, how should one disable the warning message?

@iambumblehead
Copy link
Contributor Author

inferno team / @Havunen,

The response in this related ticket is detailed and may interest you fkhadra/react-toastify#323 (comment)

@Havunen
Copy link
Member

Havunen commented Mar 15, 2019

We could add same __suppressDeprecationWarning that React uses. Its development warning anyway

@Havunen
Copy link
Member

Havunen commented Mar 15, 2019

@iambumblehead
If you want to contribute the code change, the place where this change could be implemented is here:

function warnAboutOldLifecycles(component) {
const oldLifecycles: string[] = [];
if (component.componentWillMount) {
oldLifecycles.push('componentWillMount');
}
if (component.componentWillReceiveProps) {
oldLifecycles.push('componentWillReceiveProps');
}
if (component.componentWillUpdate) {
oldLifecycles.push('componentWillUpdate');
}
if (oldLifecycles.length > 0) {
warning(`
Warning: Unsafe legacy lifecycles will not be called for components using new component APIs.
${getComponentName(component)} contains the following legacy lifecycles:
${oldLifecycles.join('\n')}
The above lifecycles should be removed.
`);
}
}

Remember test cases :)

@alanlima
Copy link
Contributor

Hey @Havunen / @iambumblehead,

If it is ok, I can submit a PR to close this issue.

I was playing around with inferno's source code and I managed to finish it.

@iambumblehead if you are already working on this issue, please ignore me ;). I just started because I would like to learn anyway and end up finishing it. 🙃

@iambumblehead
Copy link
Contributor Author

@alanlima that is awesome! I have not worked on this issue and am looking forward to using your changes.

@alanlima
Copy link
Contributor

Hi guys,

@Havunen I submitted the PR but there is a branch restriction (probably because I did PR from master branch).
I read the contribution guide and the PR should be done under dev branch, but there is any. Should I create it on my repository first?

@Havunen
Copy link
Member

Havunen commented Mar 24, 2019

@alanlima

I removed the docs about dev branch. Dev branch no longer exists, it was just more maintenance for me.

@Havunen
Copy link
Member

Havunen commented Mar 24, 2019

PR for this ticket has been merged. I will create new release.

@Havunen
Copy link
Member

Havunen commented Mar 24, 2019

7.1.11 released

@Havunen Havunen closed this as completed Mar 24, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants