Issue #3262264: Cacheability metadata bubbling does not respect original context
Merged
requested to merge issue/jsonapi_extras-3262264:3262264-cacheability-metadata-bubbling into 8.x-3.x
1 unresolved thread
Merge request reports
Activity
62 62 ->addCacheTags(['config:jsonapi_resource_config_list']); 63 63 // Apply any enhancements necessary. 64 64 $context = new Context([ 65 'resource_object' => $context['resource_object'], 65 66 'field_item_object' => $object, 66 67 CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY => $cacheability, 67 68 ]); - Comment on lines 63 to 67
I think actually this should be something similar to the original, with the
Context
object created from$context
, instead of having to know about specific keys we care about. So this would look more like:63 // Apply any enhancements necessary. 64 $context = new Context([ 65 'resource_object' => $context['resource_object'], 66 'field_item_object' => $object, 67 CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY => $cacheability, 68 ]); 63 // Apply any enhancements necessary. 64 $context = new Context($context); 65 $context->offsetSet('field_item_object', $object); 66 $context->offsetSet(CacheableNormalizerInterface::SERIALIZATION_CONTEXT_CACHEABILITY, $cacheability); I think this was an oversight/regression in the MR that added support for cacheability, where the context was originally
new Context($context)
. We need to create the object b/c the enhancer'sundoTransform()
takes a shaper context, not just an array. changed this line in version 2 of the diff
added 1 commit
- cf7542fc - Fix passing old context to the new one in FieldItemNormalizer and ResourceIdentifierNormalizer
added 11 commits
-
cf7542fc...2eafdffb - 9 commits from branch
project:8.x-3.x
- b2187f56 - 3262264-added resource_object into context of FieldItemNormalizer
- 69ba85e8 - Fix passing old context to the new one in FieldItemNormalizer and ResourceIdentifierNormalizer
-
cf7542fc...2eafdffb - 9 commits from branch
Please register or sign in to reply