From c1cddac13723f5635da81b68bcd8d51e472da2b1 Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 28 May 2020 10:23:13 +0100 Subject: [PATCH 1/2] Add url.path cache context --- src/GraphQL/Execution/FieldContext.php | 2 +- src/GraphQL/Execution/ResolveContext.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/GraphQL/Execution/FieldContext.php b/src/GraphQL/Execution/FieldContext.php index 16b8f8ab6..69e96acb9 100644 --- a/src/GraphQL/Execution/FieldContext.php +++ b/src/GraphQL/Execution/FieldContext.php @@ -26,7 +26,7 @@ class FieldContext implements RefinableCacheableDependencyInterface { * @param \GraphQL\Type\Definition\ResolveInfo $info */ public function __construct(ResolveContext $context, ResolveInfo $info) { - $this->addCacheContexts(['user.permissions']); + $this->addCacheContexts(['user.permissions', 'url.path']); $this->context = $context; $this->info = $info; } diff --git a/src/GraphQL/Execution/ResolveContext.php b/src/GraphQL/Execution/ResolveContext.php index 5a5dceb51..29bf5db3e 100644 --- a/src/GraphQL/Execution/ResolveContext.php +++ b/src/GraphQL/Execution/ResolveContext.php @@ -63,7 +63,7 @@ public function __construct( $type, array $config ) { - $this->addCacheContexts(['user.permissions']); + $this->addCacheContexts(['user.permissions', 'url.path']); $this->server = $server; $this->config = $config; From 2e16980c421eea121248f122cc3e3d628a41108d Mon Sep 17 00:00:00 2001 From: chris Date: Thu, 28 May 2020 10:53:24 +0100 Subject: [PATCH 2/2] Add url.path cache context to defaultCacheContexts in tests --- tests/src/Kernel/GraphQLTestBase.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/src/Kernel/GraphQLTestBase.php b/tests/src/Kernel/GraphQLTestBase.php index 56509e186..3e60636f0 100644 --- a/tests/src/Kernel/GraphQLTestBase.php +++ b/tests/src/Kernel/GraphQLTestBase.php @@ -113,7 +113,7 @@ protected function defaultCacheTags() { * {@inheritdoc} */ protected function defaultCacheContexts() { - return ['user.permissions']; + return ['user.permissions', 'url.path']; } /**