Skip to content

Commit 61f5cbe

Browse files
author
joweecaquicla
committed
magento/adobe-stock-integration#1387: Uncaught TypeError: Cannot read property 'complete' of undefined appears in dev console if save Previewed image as a new View and open this View on another page - suggested modifications
1 parent 154ebc0 commit 61f5cbe

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

app/code/Magento/Ui/view/base/web/js/grid/columns/image-preview.js

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ define([
3232
listens: {
3333
'${ $.provider }:params.filters': 'hide',
3434
'${ $.provider }:params.search': 'hide',
35-
'${ $.provider }:params.paging': 'hide'
35+
'${ $.provider }:params.paging': 'hide',
36+
'${ $.provider }:data.items': 'updateDisplayedRecord'
3637
},
3738
exports: {
3839
height: '${ $.parentName }.thumbnail_url:previewHeight'
@@ -48,6 +49,22 @@ define([
4849
this._super();
4950
$(document).on('keydown', this.handleKeyDown.bind(this));
5051

52+
this.lastOpenedImage.subscribe(function (newValue) {
53+
if (newValue === false && _.isNull(this.visibleRecord())) {
54+
return;
55+
}
56+
if (newValue === this.visibleRecord()) {
57+
return;
58+
}
59+
60+
if (newValue === false) {
61+
this.hide();
62+
return;
63+
}
64+
65+
this.show(this.masonry().rows()[newValue]);
66+
}.bind(this));
67+
5168
return this;
5269
},
5370

@@ -166,6 +183,17 @@ define([
166183
}
167184
},
168185

186+
/**
187+
* Update displayed record
188+
*
189+
* @param items
190+
*/
191+
updateDisplayedRecord: function (items) {
192+
if (!_.isNull(this.visibleRecord())) {
193+
this.displayedRecord(items[this.visibleRecord()]);
194+
}
195+
},
196+
169197
/**
170198
* Update image preview section height
171199
*/

0 commit comments

Comments
 (0)