Skip to content

Commit

Permalink
Merge pull request #25 from discoverygarden/feature/deferred-search-a…
Browse files Browse the repository at this point in the history
…pi-resolution

SUP-6578: Add in additional cache contexts.
  • Loading branch information
nchiasson-dgi authored Jul 12, 2024
2 parents 767a4ae + 414314f commit aa595a9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Controller/DeferredResolutionController.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Drupal\dgi_image_discovery\Controller;

use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Cache\CacheableResponse;
use Drupal\Core\Cache\CacheableResponseInterface;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
Expand Down Expand Up @@ -71,7 +72,11 @@ public function resolve(ImageStyleInterface $style, NodeInterface $node) : Cache
$response->addCacheableDependency($metadata);
}

return $response;
// Add some additional contexts representing this particular request.
$cache_meta = (new CacheableMetadata())
->addCacheContexts(['route', 'url.path']);

return $response->addCacheableDependency($cache_meta);

}

Expand Down

0 comments on commit aa595a9

Please sign in to comment.