Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Fix all review memory leak on block transform #4428

Merged
merged 1 commit into from
Jul 12, 2021

Conversation

ralucaStan
Copy link
Contributor

@ralucaStan ralucaStan commented Jul 6, 2021

There was a memory leak when previewing transform options for the All reviews block.
The preview window was fetching the reviews, but the user could move away from the transform option before the ratings loaded and the preview was shown. This PR makes sure that the preview window is still opened before updating the state of the component with the new reviews.

Fixes #4304

How to test the changes in this Pull Request:

  • Install WooBlocks plugin
  • Create an empty page and add the All Reviews block.
  • Select the block and in the toolbar select the transform option
  • Hover on one option and hover out before the preview is loaded
  • Check the console is free of error warnings

Changelog

Fix memory leak when previewing transform options for the All reviews block

@ralucaStan ralucaStan requested a review from a team as a code owner July 6, 2021 14:48
@ralucaStan ralucaStan requested review from opr and removed request for a team July 6, 2021 14:48
@ralucaStan ralucaStan marked this pull request as draft July 6, 2021 14:48
@github-actions
Copy link
Contributor

github-actions bot commented Jul 6, 2021

Size Change: +174 B (0%)

Total Size: 979 kB

Filename Size Change
build/all-reviews.js 9.61 kB +44 B (0%)
build/reviews-by-category.js 11.6 kB +45 B (0%)
build/reviews-by-product.js 13.1 kB +40 B (0%)
build/reviews-frontend.js 9.22 kB +45 B (0%)
ℹ️ View Unchanged
Filename Size
build/active-filters-frontend.js 8.28 kB
build/active-filters.js 7.84 kB
build/all-products-frontend.js 23.1 kB
build/all-products.js 37.3 kB
build/atomic-block-components/add-to-cart--atomic-block-components/button--atomic-block-components/image---a7e2bb9b.js 2.57 kB
build/atomic-block-components/add-to-cart--atomic-block-components/button.js 1.82 kB
build/atomic-block-components/add-to-cart--atomic-block-components/image--atomic-block-components/title.js 333 B
build/atomic-block-components/add-to-cart-frontend.js 8.64 kB
build/atomic-block-components/add-to-cart.js 7.72 kB
build/atomic-block-components/button-frontend.js 1.74 kB
build/atomic-block-components/button.js 873 B
build/atomic-block-components/category-list-frontend.js 469 B
build/atomic-block-components/category-list.js 477 B
build/atomic-block-components/image-frontend.js 1.87 kB
build/atomic-block-components/image.js 1.35 kB
build/atomic-block-components/price-frontend.js 2.08 kB
build/atomic-block-components/price.js 2.1 kB
build/atomic-block-components/rating-frontend.js 559 B
build/atomic-block-components/rating.js 566 B
build/atomic-block-components/sale-badge-frontend.js 854 B
build/atomic-block-components/sale-badge.js 866 B
build/atomic-block-components/sku-frontend.js 389 B
build/atomic-block-components/sku.js 393 B
build/atomic-block-components/stock-indicator-frontend.js 609 B
build/atomic-block-components/stock-indicator.js 610 B
build/atomic-block-components/summary-frontend.js 905 B
build/atomic-block-components/summary.js 911 B
build/atomic-block-components/tag-list-frontend.js 465 B
build/atomic-block-components/tag-list.js 471 B
build/atomic-block-components/title-frontend.js 1.44 kB
build/atomic-block-components/title.js 1.28 kB
build/attribute-filter-frontend.js 17.9 kB
build/attribute-filter.js 11.7 kB
build/blocks-checkout-editor.js 10.8 kB
build/blocks-checkout.js 20.2 kB
build/cart-frontend.js 79.2 kB
build/cart.js 45.9 kB
build/checkout-frontend.js 83.4 kB
build/checkout.js 48.2 kB
build/featured-category.js 7.39 kB
build/featured-product.js 9.55 kB
build/handpicked-products.js 6.55 kB
build/price-filter-frontend.js 14.4 kB
build/price-filter.js 9.57 kB
build/price-format.js 1.38 kB
build/product-best-sellers.js 6.73 kB
build/product-categories.js 3.38 kB
build/product-category.js 7.59 kB
build/product-new.js 6.89 kB
build/product-on-sale.js 7.23 kB
build/product-search.js 2.68 kB
build/product-tag.js 6.7 kB
build/product-top-rated.js 6.85 kB
build/products-by-attribute.js 7.82 kB
build/single-product-frontend.js 25.8 kB
build/single-product.js 9.87 kB
build/vendors--atomic-block-components/price-frontend.js 6.51 kB
build/wc-blocks-data.js 10.9 kB
build/wc-blocks-editor-style-rtl.css 14.9 kB
build/wc-blocks-editor-style.css 14.9 kB
build/wc-blocks-google-analytics.js 1.99 kB
build/wc-blocks-middleware.js 1.48 kB
build/wc-blocks-registry.js 2.75 kB
build/wc-blocks-shared-context.js 1.54 kB
build/wc-blocks-shared-hocs.js 1.75 kB
build/wc-blocks-style-rtl.css 19.2 kB
build/wc-blocks-style.css 19.2 kB
build/wc-blocks-vendors-style-rtl.css 1.05 kB
build/wc-blocks-vendors-style.css 1.05 kB
build/wc-blocks-vendors.js 240 kB
build/wc-blocks.js 3.51 kB
build/wc-payment-method-bacs.js 812 B
build/wc-payment-method-cheque.js 807 B
build/wc-payment-method-cod.js 903 B
build/wc-payment-method-paypal.js 844 B
build/wc-payment-method-stripe.js 12.3 kB
build/wc-settings.js 2.93 kB

compressed-size-action

@ralucaStan ralucaStan added focus: blocks Specific work involving or impacting how blocks behave. type: bug The issue/PR concerns a confirmed bug. block: all reviews Issues related to the All Reviews block. labels Jul 7, 2021
@ralucaStan ralucaStan marked this pull request as ready for review July 7, 2021 09:17
Copy link
Contributor

@opr opr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool fix, Raluca! Works well and the code seems fine to me 👏🏼

@opr opr added this to the 5.6.0 milestone Jul 12, 2021
@ralucaStan ralucaStan merged commit faf6294 into trunk Jul 12, 2021
@ralucaStan ralucaStan deleted the fix/all-reviews-memory-leak branch July 12, 2021 11:58
ralucaStan added a commit that referenced this pull request Jul 14, 2021
ralucaStan added a commit that referenced this pull request Jul 14, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block: all reviews Issues related to the All Reviews block. focus: blocks Specific work involving or impacting how blocks behave. type: bug The issue/PR concerns a confirmed bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

All Reviews block: unmount state update error
2 participants