I haven't found any code that treats field elements as cache dependencies. EntityViewDisplay should do this, but it only adds access checking as a cache dependency.
That is, now you can add cache metadata to the rendering array only through an access check. But I believe that if the list is doing value calculation, EntityViewDisplay should check if the list implements CacheacbleDependencyInterface.
With this approach, a list of elements will be able to provide metadata from its elements that implement CacheableDependencyInterface.
- last update
over 1 year ago Patch Failed to Apply - last update
over 1 year ago Patch Failed to Apply - First commit to issue fork.
- Merge request !6355Issue #3304772: Fix cache metadata bubbling for computed fields in formatters β (Closed) created by tstoeckler
- Status changed to Needs review
11 months ago 3:24pm 28 January 2024 - π©πͺGermany tstoeckler Essen, Germany
I encountered this as well, in the context of π¬ Complete JSON:API's handling of field (including computed & empty fields) cache metadata Needs work .
I went with a slightly different approach than in #7 by checking this in the field formatter rather than the entity view display. It shouldn't make much of a difference practically, but there may be cases were a formatter is used without a view display (at least theoretically).
Also added some test coverage.
- π¬π§United Kingdom catch
#10 looks like a good approach. I wondered about computed fields being used without a formatter in hook_entity_view_alter() and similar places, but then people can add their the cache metadata themselves in that case.
- πΊπΈUnited States smustgrave
So looking at the change and reading issue summary change makes sense so +1. But leaving in NR for additional eyes.
- Status changed to Needs work
10 months ago 6:34pm 25 February 2024 - πΊπΈUnited States smustgrave
Circled back to this one.
Re-verified test coverage exists here https://git.drupalcode.org/issue/drupal-3304772/-/jobs/704515
Issue summary is missing some sections, left TBD in sections I wasn't sure of as not as familiar with issue.
- Status changed to Needs review
10 months ago 6:23am 26 February 2024 - π©πͺGermany tstoeckler Essen, Germany
Filled in the proposed resolution and added a draft change notice for this, so back to needs review.
- Status changed to RTBC
10 months ago 2:17pm 26 February 2024 - πΊπΈUnited States smustgrave
Thanks! CR reads well. Everything still looks fine to me so won't stall.
- Status changed to Fixed
10 months ago 4:38pm 26 February 2024 - π¬π§United Kingdom catch
Committed/pushed to 11.x and cherry-picked to 10.3.x and 10.2.x, thanks!
- π§πͺBelgium wim leers Ghent π§πͺπͺπΊ
WOW π³ Can't believe this was wrong all this time π
Automatically closed - issue fixed for 2 weeks with no activity.