From 27508537f28b88ace65cfebf82e18c88e265fa72 Mon Sep 17 00:00:00 2001 From: Darren Ethier Date: Tue, 12 May 2020 05:08:53 -0400 Subject: [PATCH] If product is changed for featured product block, update the link in the button. (https://github.com/woocommerce/woocommerce-blocks/pull/1894) * If product is changed for featured product block, update the link in the button * add handling to _only_ update the product url when the product is changed. --- .../js/blocks/featured-product/block.js | 63 ++++++++++++++++++- 1 file changed, 61 insertions(+), 2 deletions(-) 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 2bc5885af19..95e2e1c6b49 100644 --- a/plugins/woocommerce-blocks/assets/js/blocks/featured-product/block.js +++ b/plugins/woocommerce-blocks/assets/js/blocks/featured-product/block.js @@ -13,6 +13,7 @@ import { withColors, RichText, } from '@wordpress/editor'; +import { withSelect } from '@wordpress/data'; import { Button, FocalPointPicker, @@ -27,8 +28,8 @@ import { withSpokenMessages, } from '@wordpress/components'; import classnames from 'classnames'; -import { Fragment } from '@wordpress/element'; -import { compose } from '@wordpress/compose'; +import { Fragment, Component } from '@wordpress/element'; +import { compose, createHigherOrderComponent } from '@wordpress/compose'; import { isEmpty } from 'lodash'; import PropTypes from 'prop-types'; import { MIN_HEIGHT } from '@woocommerce/block-settings'; @@ -60,6 +61,7 @@ const FeaturedProduct = ( { product, setAttributes, setOverlayColor, + triggerUrlUpdate = () => void null, } ) => { const renderApiError = () => (