{"action":"opened","issue":{"url":"https://api.github.com/repos/wwayne/react-tooltip/issues/101","repository_url":"https://api.github.com/repos/wwayne/react-tooltip","labels_url":"https://api.github.com/repos/wwayne/react-tooltip/issues/101/labels{/name}","comments_url":"https://api.github.com/repos/wwayne/react-tooltip/issues/101/comments","events_url":"https://api.github.com/repos/wwayne/react-tooltip/issues/101/events","html_url":"https://github.com/wwayne/react-tooltip/issues/101","id":154683793,"number":101,"title":"hideTooltip is fired when the component already unmounted","user":{"login":"oluckyman","id":642673,"avatar_url":"https://avatars.githubusercontent.com/u/642673?v=3","gravatar_id":"","url":"https://api.github.com/users/oluckyman","html_url":"https://github.com/oluckyman","followers_url":"https://api.github.com/users/oluckyman/followers","following_url":"https://api.github.com/users/oluckyman/following{/other_user}","gists_url":"https://api.github.com/users/oluckyman/gists{/gist_id}","starred_url":"https://api.github.com/users/oluckyman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/oluckyman/subscriptions","organizations_url":"https://api.github.com/users/oluckyman/orgs","repos_url":"https://api.github.com/users/oluckyman/repos","events_url":"https://api.github.com/users/oluckyman/events{/privacy}","received_events_url":"https://api.github.com/users/oluckyman/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-05-13T10:41:53Z","updated_at":"2016-05-13T10:41:53Z","closed_at":null,"body":"I have a component with lots of active cells with tooltips.Tooltips are initialized with 3 sec hide delay:\r\n```jsx\r\n        <ReactTooltip\r\n          offset={{ top: 10 }}\r\n          border={ true }\r\n          delayShow={ 0 }\r\n          delayHide={ 3000 }\r\n          html={ true }\r\n        />\r\n```\r\nWhen 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:\r\n<img width=\"647\" alt=\"ss 2016-05-13 at 1 34 56 pm\" src=\"https://cloud.githubusercontent.com/assets/642673/15245498/e8743a78-1917-11e6-8bee-51152cc618d4.png\">\r\nI see that it happens because of `setState` in timeout callback:\r\n```js\r\n  hideTooltip () {\r\n    const {delayHide} = this.state\r\n    clearTimeout(this.delayShowLoop)\r\n    setTimeout(() => {\r\n      this.setState({    // ← component is unmounted when the callback fired\r\n        show: false\r\n      })\r\n      this.removeScrollListener()\r\n    }, parseInt(delayHide, 10))\r\n  }\r\n```\r\nSo I gonna to introduce `delayHideLoop` variable to store the hide timeout id and clear it when the component is unmounting"}}