From 62bedeaa74fdec67ae205df9a81ac7613bdebd88 Mon Sep 17 00:00:00 2001 From: Peter Philipp Date: Fri, 14 Jul 2023 11:48:07 +0200 Subject: [PATCH] chore: More locations where a deferred saves oodles of execution time --- src/GraphQL/Resolver/AssetType.php | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/src/GraphQL/Resolver/AssetType.php b/src/GraphQL/Resolver/AssetType.php index 886cc00f..3502d943 100644 --- a/src/GraphQL/Resolver/AssetType.php +++ b/src/GraphQL/Resolver/AssetType.php @@ -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) { @@ -293,9 +291,7 @@ 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) { @@ -303,9 +299,7 @@ public function resolveResolutions($value = null, $args = [], $context = [], Res $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, ]; }