Skip to content

Commit d6a3117

Browse files
committed
Pass a valid eager-loading handle
1 parent 495d5bd commit d6a3117

2 files changed

Lines changed: 6 additions & 1 deletion

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Release Notes for Craft CMS 5
22

3+
## Unreleased
4+
5+
- Improved the performance of element indexes that contained asset thumbnails.
6+
37
## 5.1.3 - 2024-05-14
48

59
- Fixed a SQL error that could occur when applying or rebuilding the project config.

src/fields/Assets.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,8 @@ public function getThumbHtml(mixed $value, ElementInterface $element, int $size)
494494
{
495495
/** @var AssetQuery|ElementCollection $value */
496496
if ($value instanceof AssetQuery) {
497-
$value = (clone $value)->eagerly(__METHOD__);
497+
$handle = sprintf('%s-%s', preg_replace('/:+/', '-', __METHOD__), $size);
498+
$value = (clone $value)->eagerly($handle);
498499
}
499500

500501
return $value->one()?->getThumbHtml($size);

0 commit comments

Comments
 (0)