Quick add media isn't update on variant change
ludoboludo opened this issue · 0 comments
Describe the current behavior
In the quick add modal, for a product that has different variants and images tied to them, if you change the variant it doesn't update the media it's showing you when it should and used to until the previous version 13.0.1
.
Describe the expected behavior
When changing variant, the image shown should be updated as well.
Version information (Dawn, browsers and operating systems)
- Dawn Version: 14.0.0
Possible solution
Some refactor was done around product medias and this use case was missed. In updateMedia(html) {...}
we're setting the mediaGalleryDestination
based on an ID using this.dataset.section
but because we've edited those IDs in preventDuplicatedIDs()
an added quickadd-
in front of it, it's not finding the media list in the new html
we're querying.
We would need to potentially update this.dataset.section
value and remove the quickadd-
or something like that.
const mediaGalleryDestination =
html.querySelector(`[id^="MediaGallery-${this.dataset.section}"] ul`) ||
html.querySelector(`[id^="MediaGallery-${this.dataset.section.replace('quickadd-', '')}"] ul`);