Problem/Motivation
I noticed an EVA View of related content was not updating when new nodes were added or existing nodes were edited or removed. The View was using a cache tag based caching approach, so the node_list cache context should have been invalidated whenever a node was altered.
I guessed that the View was being cached correctly, but that EVA wasn't passing the cache metadata to the node, so the page cache wasn't being invalidated when a node was altered.
Proposed resolution
Changing
$element = $view->executeDisplay($info['display']);
in eva_entity_view() to:
$element = $view->buildRenderable($info['display']);
Results in the cache metadata being included as part of the renderable array, and this fixes my issue.
Before:

After:

Relevant docs
https://api.drupal.org/api/drupal/core%21modules%21views%21src%21ViewExe...
Builds the render array outline for the given display.
This render array has a #pre_render callback which will call ::executeDisplay in order to actually execute the view and then build the final render array structure.
https://api.drupal.org/api/drupal/core%21modules%21views%21src%21ViewExe...
Comments
Comment #2
Phil Wolstenholme commentedHere is a patch:
Comment #3
msmithcti commentedComment #4
ahebrank commentedThanks, the caching scope definitely needs to be added one way or another. Looking for feedback on whether using buildRenderable causes trouble for anyone and whether any cruft can be removed as a consequence of this change.
Comment #5
ahebrank commentedI've taken a look this morning and the only end-to-end differences I see are the addition of the views'
config:*andnode_listcache tags to page headers. I'm inclined to merge this to dev ASAP but will keep under review for testing for a few more days.Comment #7
ahebrank commentedMerged to dev to get some more visibility. Thanks again.
Comment #8
ahebrank commentedIn 8.x-1.1-rc1 release
Comment #9
ahebrank commented