Proposed commit message:
Issue #2474121 by pwolanin, Wim Leers: CacheableMetadata should get BubbleableMetadata's merge/applyTo/createFromRenderArray/createFromObject methods
Necessary for #2335661: Outbound path & route processors must specify cacheability metadata, and sensible for symmetry.
Please credit pwolanin, who did most of the work on this patch in #2335661: Outbound path & route processors must specify cacheability metadata, this was just split off to a different issue to keep the other one focused.
Beta phase evaluation
| Issue category | Task, because it is a simple task. |
|---|---|
| Issue priority | Normal, because the task in itself is normal, however a critical issue depends on it. |
| Prioritized changes | The main goal of this issue is to unblock work that promises correctness and more performance in the caching layer. |
| Disruption | Not disruptive, because BubbleableMetadata keeps BC, only methods are moved. |
| Comment | File | Size | Author |
|---|---|---|---|
| #5 | 2474121-5.patch | 19.6 KB | wim leers |
Comments
Comment #1
wim leersComment #2
fabianx commentedComment #3
fabianx commentedReviewing #2099137: Entity/field access and node grants not taken into account with core cache contexts: That issue uses BubbleableMetadata needlessly when this patch goes in.
Should we convert usages of BubbleableMetadata that should have been CacheableMetadata here or in a follow-up?
Comment #4
wim leersLet's do it here.
Comment #5
wim leersSo, what #3 referred to is basically addressing @yched's #2099137-161: Entity/field access and node grants not taken into account with core cache contexts, point 7, which was out of scope to change there, but thanks to the changes here, we can now actually address that.
At the same time, we can update
RendererInterface::addDependency()to use this.Comment #6
fabianx commentedRTBC, the remaining usages of BubbleableMetadata want to deal with #post_render_cache or #attached ...
Comment #7
alexpottThis blocks a critical. Committed 149c25e and pushed to 8.0.x. Thanks!
Thanks for adding the beta evaluation to the issue summary.
Fixed on commit.
Comment #9
wim leersThanks!
Rerolled the blocked issue, and noticed a small flaw/thing we missed in this patch. See #2335661-69: Outbound path & route processors must specify cacheability metadata.
Comment #10
fabianx commentedI think its worth doing a quick follow-up for that normal bug to add the instanceof so we don't forget independently of the other issue ...
Comment #11
wim leers#10: done: #2475397: Tiny follow-up for #2474121 + unit test coverage for (Bubbleable|Cacheable)Metadata::merge().
Comment #14
yched commented#2099137: Entity/field access and node grants not taken into account with core cache contexts had \Drupal\views\Plugin\views\field\Field::getItems() merge BubblebleMetadata from the formatter's render array wrapper (which Views doesn't render) into each of the children (which are the ones that get rendered)
This patch here changed that to merging CacheableMetadata instead, leaving out #attached. Meaning, formatters who include assets are broken in Views, unless they repeatedly #attach them to each item children.
I posted a patch in #2496039: Formatter's #attached assets are not carried over by Views before realizing this had been explicitly changed here, so feedback welcome :-)