Lakewood, CO
Account created on 21 April 2009, almost 16 years ago
  • Software Engineering Manager at AccentureΒ 
#

Recent comments

πŸ‡ΊπŸ‡ΈUnited States vegantriathlete Lakewood, CO

This is an interesting approach to tackling this problem. It's a decent start. Here are the limitations I am seeing:

It makes heavy assumptions about using nodes. The entity references won't necessarily be limited to nodes; they could be to media or terms, for example. So, for media references, the cache tag would not be node:[nid], it would be media:[mid].

It appears to stop at one level and expects that you have a node that references a paragraph that has an entity reference. It's also possible that you could have nested paragraphs that ultimately have an entity reference field.

Finally, associating the cache tags with the node entity will cause the entire node view template to be invalidated. If I understand Drupal's caching and rendering properly, I thought it has the ability to invalidate just part of a page. It would be preferable to have the cache tags tied to the correct element / layer of the render array.

I'm going to continue thinking on this and see what I can do with hook_ENTITY_TYPE_entity_build_defaults_alter.

Production build 0.71.5 2024