Skip to content
Snippets Groups Projects

Issue #3262264: Cacheability metadata bubbling does not respect original context

Merged Issue #3262264: Cacheability metadata bubbling does not respect original context
1 unresolved thread
1 unresolved thread

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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:

    Suggested change
    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's undoTransform() takes a shaper context, not just an array.

  • Yeah i think that is the fix, i'll push this through.

  • changed this line in version 2 of the diff

  • Please register or sign in to reply
  • Björn Brala added 1 commit

    added 1 commit

    • cf7542fc - Fix passing old context to the new one in FieldItemNormalizer and ResourceIdentifierNormalizer

    Compare with previous version

  • Björn Brala added 11 commits

    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

    Compare with previous version

  • merged

  • Please register or sign in to reply
    Loading