Skip to content

Commit fcd09ec

Browse files
committed
feat(slb-267): add queryId to cache contexts
1 parent f3c1bdb commit fcd09ec

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<?php
2+
23
namespace Drupal\silverback_graphql_persisted\EventSubscriber;
34

45
use Drupal\graphql\Event\OperationEvent;
@@ -7,21 +8,28 @@
78
/**
89
* Fix GraphQL caching when internal page cache is active:
910
*
10-
* TODO:
11+
* @todo
1112
* Can be removed when https://github.com/drupal-graphql/graphql/pull/1317 is
1213
* resolved.
1314
*/
1415
class FixGraphQLCachingSubscriber implements EventSubscriberInterface {
1516

17+
/**
18+
*
19+
*/
1620
public function onBeforeOperation(OperationEvent $event): void {
1721
$event->getContext()->addCacheContexts(
18-
['url.query_args:variables', 'url.query_args:extensions']
22+
['url.query_args:queryId', 'url.query_args:variables', 'url.query_args:extensions']
1923
);
2024
}
2125

26+
/**
27+
*
28+
*/
2229
public static function getSubscribedEvents() {
2330
return [
2431
OperationEvent::GRAPHQL_OPERATION_BEFORE => 'onBeforeOperation',
2532
];
2633
}
34+
2735
}

0 commit comments

Comments
 (0)