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

hideTooltip is fired when the component already unmounted #101

Closed
oluckyman opened this issue May 13, 2016 · 0 comments
Closed

hideTooltip is fired when the component already unmounted #101

oluckyman opened this issue May 13, 2016 · 0 comments

Comments

@oluckyman
Copy link
Contributor

I have a component with lots of active cells with tooltips.Tooltips are initialized with 3 sec hide delay:

        <ReactTooltip
          offset={{ top: 10 }}
          border={ true }
          delayShow={ 0 }
          delayHide={ 3000 }
          html={ true }
        />

When the user hovers the cells there is lots of hide timeouts fired and if the user navigates to another page (ReactTooltip is being unmounted) the timeouts are start firing and throws the errors into console:
ss 2016-05-13 at 1 34 56 pm
I see that it happens because of setState in timeout callback:

  hideTooltip () {
    const {delayHide} = this.state
    clearTimeout(this.delayShowLoop)
    setTimeout(() => {
      this.setState({    // ← component is unmounted when the callback fired
        show: false
      })
      this.removeScrollListener()
    }, parseInt(delayHide, 10))
  }

So I gonna to introduce delayHideLoop variable to store the hide timeout id and clear it when the component is unmounting

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

No branches or pull requests

1 participant