Allow facet to be cached

Created on 31 July 2025, 1 day ago

Problem/Motivation

RangeListItem extends ProcessorPluginBase which has the UncacheableDependencyTrait so the facet results are never cached.

Steps to reproduce

Create a facet using RangeListItem.
The facet is recalculated every time.

Proposed resolution

Just using CacheableDependencyTrait could be enough, the facet results only change when the facet is updated.

Remaining tasks

User interface changes

API changes

Data model changes

Feature request
Status

Active

Version

1.2

Component

Code

Created by

🇫🇷France prudloff Lille

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

Comments & Activities

  • Issue created by @prudloff
  • @prudloff opened merge request.
  • 🇩🇰Denmark ressa Copenhagen

    Thanks @prudloff, this would be a great addition. I wanted to review the patch, but ran into problems, and not sure of the best method to verify a cache hit ... Should I just check to see if these browser headers change?

    {
      "name": "x-drupal-cache",
      "value": "UNCACHEABLE (response policy)"
    },
    {
      "name": "x-drupal-dynamic-cache",
      "value": "UNCACHEABLE (poor cacheability)"
    },
    
  • 🇫🇷France prudloff Lille

    Yes looking at those headers is helpful but it can be tricky to test if you have other parts of the page that prevent caching.

    Another way to test this is to save your view. Without the patch, the view display will have this config:

        cache_metadata:
          max-age: 0
    

    With the patch, it should turn to -1 (if your view is cacheable of course).

Production build 0.71.5 2024