Skip to content

Commit 1f8764d

Browse files
committed
Language metadata fixes.
1 parent deefd97 commit 1f8764d

4 files changed

Lines changed: 16 additions & 3 deletions

File tree

modules/graphql_core/tests/src/Kernel/Blocks/BlockTest.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ public function testStaticBlocks() {
6767
$query = $this->getQueryFromFile('Blocks/blocks.gql');
6868
$metadata = $this->defaultCacheMetaData();
6969

70+
$metadata->addCacheContexts([
71+
'languages:language_content',
72+
]);
73+
7074
// TODO: Check cache metadata.
7175
$metadata->addCacheTags([
7276
'config:block_list',

modules/graphql_core/tests/src/Kernel/GraphQLContentTestBase.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ class GraphQLContentTestBase extends GraphQLCoreTestBase {
2929
'text',
3030
];
3131

32+
protected function defaultCacheContexts() {
33+
return array_merge([
34+
'languages:language_content',
35+
], parent::defaultCacheContexts());
36+
}
37+
3238
/**
3339
* {@inheritdoc}
3440
*/

modules/graphql_core/tests/src/Kernel/GraphQLCoreTestBase.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ protected function defaultCacheTags() {
2525
'entity_bundles',
2626
'entity_types',
2727
'entity_field_info',
28-
'languages:language_content',
2928
], parent::defaultCacheTags());
3029
}
3130

src/Plugin/Deriver/PluggableSchemaDeriver.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,11 @@ public function getDerivativeDefinitions($basePluginDefinition) {
9898

9999
$cacheContexts = array_reduce($managers, function ($carry, CacheableDependencyInterface $current) {
100100
return Cache::mergeContexts($carry, $current->getCacheContexts());
101-
}, []);
101+
}, [
102+
// As long as the endpoint url language might have effect, we have to
103+
// keep it.
104+
'languages:language_url',
105+
]);
102106

103107
$cacheMaxAge = array_reduce($managers, function ($carry, CacheableDependencyInterface $current) {
104108
return Cache::mergeMaxAges($carry, $current->getCacheMaxAge());
@@ -375,4 +379,4 @@ protected function buildMutationMap(MutationPluginManager $manager) {
375379
}, $mutations);
376380
}
377381

378-
}
382+
}

0 commit comments

Comments
 (0)