From ce30a9f1ff2324ea3ef70824d3abf624f00016b6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Albert=20Juh=C3=A9=20Lluveras?= Date: Tue, 27 Aug 2019 11:38:28 +0200 Subject: [PATCH] Reviews blocks: Fix warnings with components state (https://github.com/woocommerce/woocommerce-blocks/pull/908) --- .../assets/js/base/hocs/with-reviews.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/plugins/woocommerce-blocks/assets/js/base/hocs/with-reviews.js b/plugins/woocommerce-blocks/assets/js/base/hocs/with-reviews.js index b2f6dc9cba7..95a5415bdc3 100644 --- a/plugins/woocommerce-blocks/assets/js/base/hocs/with-reviews.js +++ b/plugins/woocommerce-blocks/assets/js/base/hocs/with-reviews.js @@ -17,7 +17,7 @@ const withReviews = ( OriginalComponent ) => { this.state = { error: null, - loading: false, + loading: true, reviews: [], totalReviews: 0, }; @@ -52,6 +52,12 @@ const withReviews = ( OriginalComponent ) => { ); } + componentWillUnMount() { + if ( this.delayedAppendReviews.cancel ) { + this.delayedAppendReviews.cancel(); + } + } + getArgs( reviewsToSkip ) { const { categoryIds, order, orderby, productId, reviewsToDisplay } = this.props; const args = {