Skip to content

Commit eca8681

Browse files
committed
Merge branch '5.x' into 5.10
[ci skip]
2 parents 349b603 + 25b5d25 commit eca8681

4 files changed

Lines changed: 16 additions & 17 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Unreleased
44

55
- Fixed a bug where dependencies required by `composer.json` were getting updated when installing/updating plugins. ([#18755](https://github.com/craftcms/cms/issues/18755))
6+
- Fixed a bug where element thumbnails weren’t always getting loaded when they became visible.
67

78
## 5.9.21 - 2026-04-23
89

src/web/assets/cp/dist/cp.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/cp/dist/cp.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/web/assets/cp/src/js/ElementThumbLoader.js

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,25 @@ Craft.ElementThumbLoader = Garnish.Base.extend(
1818

1919
load: function ($elements) {
2020
// Only immediately load the visible images
21-
let $thumbs = $elements.find('.thumb[data-sizes]');
21+
const $thumbs = $elements.find('.thumb[data-sizes]');
2222
for (let i = 0; i < $thumbs.length; i++) {
23-
let $thumb = $thumbs.eq(i);
23+
const $thumb = $thumbs.eq(i);
2424
if ($thumb.is(':visible')) {
2525
this.addToQueue($thumb[0]);
2626
} else {
27-
let key = 'thumb' + Math.floor(Math.random() * 1000000);
27+
const key = `thumb${Math.floor(Math.random() * 1000000)}`;
2828
Craft.ElementThumbLoader.invisibleThumbs[key] = [this, $thumb];
29-
Garnish.$doc.on(
30-
`scroll.${key}`,
31-
{
32-
$thumb: $thumb,
33-
key: key,
34-
},
35-
(ev) => {
36-
if ($thumb) {
37-
delete Craft.ElementThumbLoader.invisibleThumbs[ev.data.key];
38-
this.addToQueue(ev.data.$thumb[0]);
39-
}
29+
const handler = () => {
30+
if (
31+
Craft.ElementThumbLoader.invisibleThumbs[key] &&
32+
$thumb.is(':visible')
33+
) {
34+
delete Craft.ElementThumbLoader.invisibleThumbs[key];
35+
this.addToQueue($thumb[0]);
4036
}
41-
);
37+
};
38+
Garnish.$doc.on(`scroll.${key}`, handler);
39+
Garnish.$win.on(`resize.${key}`, handler);
4240
}
4341
}
4442
},

0 commit comments

Comments
 (0)