diff --git a/plugins/woocommerce-blocks/assets/js/blocks/featured-category/block.js b/plugins/woocommerce-blocks/assets/js/blocks/featured-category/block.js index 129f6d964c9..690c2d7c9f3 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/featured-category/block.js +++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-category/block.js @@ -112,6 +112,10 @@ class FeaturedCategory extends Component { this.getCategory(); } + componentWillUnmount() { + this.debouncedGetCategory.cancel(); + } + componentDidUpdate( prevProps ) { if ( prevProps.attributes.categoryId !== this.props.attributes.categoryId ) { this.debouncedGetCategory(); diff --git a/plugins/woocommerce-blocks/assets/js/blocks/featured-product/block.js b/plugins/woocommerce-blocks/assets/js/blocks/featured-product/block.js index b68c2472945..a6b4e53ebbd 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/featured-product/block.js +++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-product/block.js @@ -96,6 +96,10 @@ class FeaturedProduct extends Component { this.getProduct(); } + componentWillUnmount() { + this.debouncedGetProduct.cancel(); + } + componentDidUpdate( prevProps ) { if ( prevProps.attributes.productId !== this.props.attributes.productId ) { this.debouncedGetProduct(); diff --git a/plugins/woocommerce-blocks/assets/js/components/product-attribute-control/index.js b/plugins/woocommerce-blocks/assets/js/components/product-attribute-control/index.js index e6fb8235067..5d4d9f1b897 100644 --- a/plugins/woocommerce-blocks/assets/js/components/product-attribute-control/index.js +++ b/plugins/woocommerce-blocks/assets/js/components/product-attribute-control/index.js @@ -51,6 +51,10 @@ class ProductAttributeControl extends Component { } ); } + componentWillUnmount() { + this.debouncedGetTerms.cancel(); + } + componentDidUpdate( prevProps, prevState ) { if ( prevState.attribute !== this.state.attribute ) { this.debouncedGetTerms(); diff --git a/plugins/woocommerce-blocks/assets/js/components/products-control/index.js b/plugins/woocommerce-blocks/assets/js/components/products-control/index.js index b34928f1465..98090ddee8a 100644 --- a/plugins/woocommerce-blocks/assets/js/components/products-control/index.js +++ b/plugins/woocommerce-blocks/assets/js/components/products-control/index.js @@ -35,6 +35,10 @@ class ProductsControl extends Component { } ); } + componentWillUnmount() { + this.debouncedOnSearch.cancel(); + } + onSearch( search ) { const { selected } = this.props; getProducts( { selected, search } )