Skip to content

Commit

Permalink
chore: More locations where a deferred saves oodles of execution time
Browse files Browse the repository at this point in the history
  • Loading branch information
das-peter committed Jul 14, 2023
1 parent c2e8988 commit 62bedea
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/GraphQL/Resolver/AssetType.php
Original file line number Diff line number Diff line change
Expand Up @@ -211,9 +211,7 @@ public function resolveSrcSet($value = null, $args = [], $context = [], ResolveI
if (!$resolveInfo || $resolveInfo->fieldName !== 'data') {
$deferredThumbnail = true;
}
//@TODO: check if we can use the $deferredThumbnail variable with the new method too
// $thumbnail = $asset->getThumbnail($args['thumbnail'], $deferredThumbnail);
$thumbnail = $assetFieldHelper->getAssetThumbnail($asset, $thumbNailConfig, $thumbNailFormat);
$thumbnail = $assetFieldHelper->getAssetThumbnail($asset, $thumbNailConfig, $thumbNailFormat, $deferredThumbnail);
$thumbnailConfig = $asset->getThumbnailConfig($args['thumbnail']);
if ($thumbnailConfig) {
foreach ($thumbnailConfig->getMedias() as $key => $val) {
Expand Down Expand Up @@ -293,19 +291,15 @@ public function resolveResolutions($value = null, $args = [], $context = [], Res
if (!$asset) {
return [];
}
//@TODO: check if we can use the $deferredThumbnail variable with the new method too
// before we had: $thumbnail = $asset->getThumbnail($thumbnailName, $deferredThumbnail);
$thumbnail = $assetFieldHelper->getAssetThumbnail($asset, $thumbnailName, $thumbnailFormat);
$thumbnail = $assetFieldHelper->getAssetThumbnail($asset, $thumbnailName, $thumbnailFormat, $deferredThumbnail);
if (isset($thumbnail)) {
$thumbnailConfig = $thumbnail->getConfig();
foreach ($types as $type) {
$thumbConfigRes = clone $thumbnailConfig;
$thumbConfigRes->setHighResolution($type);
$thumbConfigRes->setMedias([]);
$resolutions[] = [
//@TODO: check if we can use the $deferredThumbnail variable with the new method too
// $asset->getThumbnail($thumbConfigRes, $deferredThumbnail),
'url' => $assetFieldHelper->getAssetThumbnail($asset, $thumbConfigRes, $thumbnailFormat),
'url' => $assetFieldHelper->getAssetThumbnail($asset, $thumbConfigRes, $thumbnailFormat, $deferredThumbnail),
'resolution' => $type,
];
}
Expand Down

0 comments on commit 62bedea

Please sign in to comment.