Cron runs can break styling in Views that use search index view mode

Created on 2 December 2020, over 3 years ago
Updated 6 May 2024, about 1 month ago

Problem/Motivation

Cron running in conjunction with a View content format using the "Search index" view mode results in recently updated nodes to render unstyled in the view. (If cache is not cleared before the View is rendered.)

This happens for anonymous users, not for logged in users. (Edit: I would note that a workaround is to use a different view mode. E.g. "Search result highlighting input" or "Teaser" etc.)

We came across this behaviour on a client site (8.9.9) and I have confirmed it on a vanilla install of 9.0.9.

Steps to reproduce

  1. Enable the "Search index" view mode for a content type. (e.g. Basic page)
  2. Use a View to display a list of nodes, using the "Search index" view mode.
  3. As an anonymous user, visit the View page, note styling. (For the screenshot, I used a View to list search results, but this happens with any old listing of nodes in a View.)
  4. Update (or simply resave) one of the nodes that are displayed by the View.
  5. Run cron. (Do not clear cache.)
  6. Still as an anonymous user, reload the View page. The styling for the updated node has changed.

Proposed resolution

Add "max-age" cache key to render array in indexNode() and set it to zero, so cron's subsequent indexing of the updated node does not break styling for anonymous users.

πŸ› Bug report
Status

Needs work

Version

11.0 πŸ”₯

Component
Node systemΒ  β†’

Last updated about 15 hours ago

No maintainer
Created by

πŸ‡ͺπŸ‡ͺEstonia mmatsoo

Live updates comments and jobs are added and updated live.
  • Needs tests

    The change is currently missing an automated test that fails when run with the original code, and succeeds when the bug has been fixed.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    This issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request β†’ as a guide.

    Started tests for #2 on 10.1.x

    This was previously tagged for tests which still need to happen.

    Did not test issue.

  • Status changed to Needs review about 1 month ago
  • πŸ‡ΊπŸ‡ΈUnited States apotek

    This patch seems to work as advertised. I don't know why this issue was taken from needs review to needs work without feedback. What is the patch lacking? Can that be made explicit? Putting this back to needs review.

  • Status changed to Needs work about 1 month ago
  • πŸ‡ΊπŸ‡ΈUnited States smustgrave

    This was previously tagged for tests which still need to happen.

    See #13

Production build 0.69.0 2024