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

fix:(issue#1255-unmounted-uncontrolledtooltip) #1256

Closed
wants to merge 2 commits into from
Closed

fix:(issue#1255-unmounted-uncontrolledtooltip) #1256

wants to merge 2 commits into from

Conversation

jeff-nz
Copy link
Contributor

@jeff-nz jeff-nz commented Oct 9, 2018

  • Bug fix
  • New feature
  • Chore
  • Breaking change
  • There is an open issue which this change addresses
  • I have read the CONTRIBUTING document.
  • My commits follow the Git Commit Guidelines
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

This fixes the issue on:
#1255

Error message in console
warning.js:33 Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
in UncontrolledTooltip (created by [redacted])
[redacted]
printWarning @ warning.js:33
warning @ warning.js:57
warnAboutUpdateOnUnmounted @ react-dom.development.js:11186
scheduleWorkImpl @ react-dom.development.js:12130
scheduleWork @ react-dom.development.js:12082
enqueueSetState @ react-dom.development.js:6644
Component.setState @ react.development.js:238
toggle @ reactstrap.es.js:5337
toggle @ reactstrap.es.js:4180
hide @ reactstrap.es.js:4123
setTimeout (async)
onMouseLeaveTooltip @ reactstrap.es.js:4077

@TheSharpieOne
Copy link
Member

Can you apply this changes to Tooltip instead of UncontrolledTooltip

@jeff-nz
Copy link
Contributor Author

jeff-nz commented Oct 9, 2018

Hi @TheSharpieOne ,

The Tooltip component does not set or use any state of its own. This component is only passing props.

However, UncontrolledTooltip has its own state which is causing the issue reported.

Regards,
Jeff

@TheSharpieOne
Copy link
Member

Tooltip is what triggers the toggle callback. This problem originates within Tooltip, Tooltip should not be triggering the toggle function if it is unmounted.

@jeff-nz
Copy link
Contributor Author

jeff-nz commented Oct 9, 2018

It's before calling the Tooltip Component that the error is triggered. The error is about setting state on component that is unmounted

Error message that looked like:

Error message in console
warning.js:33 Warning: Can't call setState (or forceUpdate) on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in the componentWillUnmount method.
in UncontrolledTooltip (created by [redacted])
[redacted]
printWarning @ warning.js:33
warning @ warning.js:57
warnAboutUpdateOnUnmounted @ react-dom.development.js:11186
scheduleWorkImpl @ react-dom.development.js:12130
scheduleWork @ react-dom.development.js:12082
enqueueSetState @ react-dom.development.js:6644
Component.setState @ react.development.js:238
toggle @ reactstrap.es.js:5337
toggle @ reactstrap.es.js:4180
hide @ reactstrap.es.js:4123
setTimeout (async)
onMouseLeaveTooltip @ reactstrap.es.js:4077

@jeff-nz
Copy link
Contributor Author

jeff-nz commented Oct 9, 2018

@jeff-nz
Copy link
Contributor Author

jeff-nz commented Oct 9, 2018

I hope the additional resource help. The issue is before re-rendering the Tooltip Component.

@jeff-nz
Copy link
Contributor Author

jeff-nz commented Oct 9, 2018

I found an article from the react site that talks about an issue similar to this one and the solution. This issue is a bit complicated, I hope the article can help.

Here's the link:
https://reactjs.org/blog/2015/12/16/ismounted-antipattern.html

@jeff-nz
Copy link
Contributor Author

jeff-nz commented Oct 11, 2018

Feel free to merge whenever you are ready.

@TheSharpieOne
Copy link
Member

I am closing this in favor of canceling the timeouts when the Tooltip unmounts.

@amillward
Copy link
Contributor

I am closing this in favor of canceling the timeouts when the Tooltip unmounts.

Did that fix happen? I still get the error reported in #1255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants