Skip to content

Commit b92bbc4

Browse files
author
niravkrish
committed
Fixed-#18017 magento 2.3
1 parent 52130ac commit b92bbc4

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

app/code/Magento/Swatches/view/frontend/web/js/swatch-renderer.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,15 @@ define([
12231223
}
12241224

12251225
imagesToUpdate = this._setImageIndex(imagesToUpdate);
1226-
gallery.updateData(imagesToUpdate);
1226+
1227+
if (gallery === undefined) {
1228+
context.find(this.options.mediaGallerySelector).on('gallery:loaded', function (loadedGallery) {
1229+
loadedGallery = context.find(this.options.mediaGallerySelector).data('gallery');
1230+
loadedGallery.updateData(imagesToUpdate);
1231+
}.bind(this));
1232+
} else {
1233+
gallery.updateData(imagesToUpdate);
1234+
}
12271235

12281236
if (isInitial) {
12291237
$(this.options.mediaGallerySelector).AddFotoramaVideoEvents();

0 commit comments

Comments
 (0)