Skip to content

Commit

Permalink
Merge pull request #3980 from reactioncommerce/fix-3973-prinzdezibel-…
Browse files Browse the repository at this point in the history
…fix-browser-console-error

Fix for "Browser console warning when beginning checkout"
  • Loading branch information
spencern committed Mar 15, 2018
2 parents c3a7cf9 + 7f83fac commit eb422f3
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ const wrapComponent = (Comp) => (
};
}

componentDidMount() {
this._isMounted = true;
}

componentWillUnmount() {
this._isMounted = false;
}

handleCartQuantityChange = (event, quantity) => {
this.setState({
cartQuantity: Math.max(quantity, 1)
Expand Down Expand Up @@ -174,7 +182,9 @@ const wrapComponent = (Comp) => (
$("#spin").addClass("hidden");
$(".cart-alert-text").text(`${this.state.productClick * quantity} ${addToCartTitle} ${addToCartText}`);
$(".cart-alert-text").fadeIn("slow");
this.setState({ productClick: 0 });
if (this._isMounted) {
this.setState({ productClick: 0 });
}
}, 2000);

clearTimeout(this.animationTimeOut);
Expand Down

0 comments on commit eb422f3

Please sign in to comment.