-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The product image updates when a characteristic is selected. #760
The product image updates when a characteristic is selected. #760
Conversation
…xt to show the correct picture on selection.
} | ||
|
||
/** | ||
* Creates a selector that retrieves the featured image URL for a selectred characteristic. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Type selectre
d
const Media = ({ | ||
'aria-hidden': ariaHidden, productId, variantId, imageUrl, | ||
}) => { | ||
if (imageUrl) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whenever the an imageUrl
is available a ProductImage
is rendered, instead of the MediaSlider
/ ImageSlider
. Since all products from the variants provide an imageUrl, the galleries will not be rendered anymore.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What i meant with this comment is, that the won't be image sliders anymore when the code would be merged.
// imageUrl will always have a value after the very first characteristic value was selected
if (imageUrl) {
return (<ProductImage />)
}
// Will never be rendered again for child products
return (<ImageSlider />)
With your latest changes you link this product image to the first image of the parent product. So if one clicks the product image, there is a high chance, that a wrong image is presented on the gallery page.
… wrapped the image with a link to the image gallery.
makeGetProductByCharacteristic, | ||
makeGetCharacteristicFeaturedImage, | ||
} from '../variants'; | ||
import { wrapMemoizedSelector } from '../helpers'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry... the wrapMemoizedSelector
module was also added to a PR which is already merged. So i move my comment from the last review here.
Could you please add a more detailed description to this function? It seems to test basic functionality of reselect, since it's an expected behaviour, that a selector returns the same value for multiple calls with the same args and state.
I think, there is no way to run into the error situation, even if the function would be called with a common selector, which was created without the make pattern. The only way to test the selector factories is to call them twice and compare the returned selector instances.
Description
Instead of waiting for the variant selection to be completed, the product image now updates when a single characteristic, like e.g. the color, is selected.
Type of change
Please add an "x" into the option that is relevant:
How to test it
Please describe here any specialty that the tester should be aware of.