uiowa / uiowa

The base application on Acquia Cloud for the University of Iowa.
11 stars 9 forks source link

Bug - Can only intentionally re-render an entity so many times #6373

Open pyrello opened 1 year ago

pyrello commented 1 year ago

Problem/Steps to reproduce

The easiest way to see this is to visit https://sandbox.prod.drupal.uiowa.edu/people-directory and notice the Sean Adams-Hiett cards have an image, despite what the people list block settings show.

Here is the Xdebug output for the image field before it is rendered. Note that #cache is the only array key in the field_image render array. Our card build check currently filters this out because when allowed to render, this produces empty output.

field_image = {array[1]} 
 #cache = {array[3]} 
  contexts = {array[1]} 
   0 = "user.permissions"
  tags = {array[1]} 
   0 = "media:1041"
  max-age = {int} -1

Proposed solution

My best idea is to find the points in the processing of building the view and node teaser render arrays and set breakpoints to see if the information above is more complete at some point earlier in the process. If so, try to find the mechanism that is stripping out the other information that would allow this to render.

cory-skeers commented 1 year ago

This has cropped up again: https://psychology.prod.drupal.uiowa.edu/research/areas-focus (look for Eliot Hazeltine). His portrait appears in some places on the page but not others, despite having the same block settings (outside of filters).

joewhitsitt commented 1 year ago

Seeing this on sandbox.prod.drupal.uiowa.edu/node/41. What is interesting with this example is the first block has four articles displayed and the last two images are displaying. Most of the block below it only show the first two items where the images are missing.

Locally, once there are 21 blocks calling the same node, the images stop displaying. At 20 instances of the node, the images display in the first block. See the text find count in the images below:

Screenshot 2023-10-12 at 10 26 45 AM Screenshot 2023-10-12 at 10 27 13 AM
joewhitsitt commented 1 year ago

Also recall this issue with media within WYSIWYG areas on a page: https://iowaweb.slack.com/archives/C8SM82ZFZ/p1667425762764869

no img tag in sight

drupal just throws in the towel

joewhitsitt commented 1 year ago

Just found this: https://www.drupal.org/project/drupal/issues/2940605

Can only intentionally re-render an entity with references 20 times

\Drupal\Core\Field\Plugin\Field\FieldFormatter\EntityReferenceFieldFormatter::viewElements() tracks how many times an "instance" of a reference has been rendered, to avoid ending up in a recursive loop, which is understandable.

joewhitsitt commented 1 year ago

This is related https://github.com/uiowa/uiowa/issues/5138

bspeare commented 11 months ago

Here's another example of too many images on a page: https://sandbox.prod.drupal.uiowa.edu/small-and-medium-responsive-images