Cache metadata is not captured when no results

Created on 8 March 2024, 10 months ago
Updated 2 May 2024, 8 months ago

Problem/Motivation

In ViewsReferenceFieldFormatter
If a view has no results, the cache metadata is not written to the return value.
This can cause an empty result to be stuck in the cache for all pages.

This was already pointed out in πŸ› Viewsreference embeds Views without cache, breaking Dynamic page cache Fixed , but it was not fixed in the correct way, and the solution was reverted in πŸ› Issue 2919092 breaks BC and causes issues for existing sites Needs review .

Steps to reproduce

  1. Create a node type with viewreference field.
    (we actually used a paragraph for this, but I assume a simple node field will work too)
  2. Create a view with filters.
    (we actually used search api solr and facets, but I assume filters might work too)
  3. Embed into content using viewreference field.
  4. (If using facets, also place facet blocks).
  5. Clear cache (e.g. drush cr)
  6. Visit the node url but with filters applied to get no results.
  7. Visit the node url without filter.

Expected: In last step, the result is not empty.
Actual: In last step, the result is empty.

Proposed resolution

Collect cache metadata from all views, and write it to the result.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Fixed

Version

2.0

Component

Miscellaneous

Created by

πŸ‡©πŸ‡ͺGermany donquixote

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

Production build 0.71.5 2024