Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
fix(Tooltip): clear timeouts on unmount (#1562)
Fixes #1255
  • Loading branch information
jinixx authored and TheSharpieOne committed Jul 8, 2019
1 parent 31e3f87 commit e85238b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/TooltipPopoverWrapper.js
Expand Up @@ -82,14 +82,19 @@ class TooltipPopoverWrapper extends React.Component {
this.getRef = this.getRef.bind(this);
this.onClosed = this.onClosed.bind(this);
this.state = { isOpen: props.isOpen };
this._isMounted = false;
}

componentDidMount() {
this._isMounted = true;
this.updateTarget();
}

componentWillUnmount() {
this._isMounted = false;
this.removeTargetEvents();
this.clearShowTimeout();
this.clearHideTimeout();
}

static getDerivedStateFromProps(props, state) {
Expand Down Expand Up @@ -279,7 +284,7 @@ class TooltipPopoverWrapper extends React.Component {
}

toggle(e) {
if (this.props.disabled) {
if (this.props.disabled || !this._isMounted) {
return e && e.preventDefault();
}

Expand Down

0 comments on commit e85238b

Please sign in to comment.