Views Exposed Filter Block not inheriting the display handlers cache tags, causing filter options not to appear

Created on 15 July 2019, almost 6 years ago
Updated 19 May 2025, 15 days ago

Problem/Motivation

Steps to reproduce:

  1. Install Drupal (standard profile)
  2. Edit the "Content" view (/admin/structure/views/view/content)
  3. Add an exposed filter for the "Tags" (field_tags) field. Make sure to "Dropdown" as "Selection type".
  4. Change "Exposed form in block" to "Yes"
  5. Save the view
  6. Go the block layout page for the "Seven" theme (/admin/structure/block/list/seven)
  7. Click the "Place block" button next to "Content"
  8. Click "Place block" in the "Exposed form: content-page_1" row
  9. Restrict the visibility of the block by page: "/admin/content" (not necessary but to avoid confusion)
  10. Click the "Save block" button the block configuration modal
  11. Navigate to the "Content" page (/admin/content).
  12. You will see the exposed block with the "Tags" filter being empty.
  13. Add a new term "Test" in the "Tags" vocabulary (/admin/structure/taxonomy/manage/tags/add)
  14. Visit the content page again (/admin/content). The "Tags" filter is still empty.

Expected behavior: you can select "Test" in the "Tags" filter.

There is already another issue about terms in the exposed filter not updating @ 🐛 Exposed term filter is not updated when terms are added, deleted, or rearranged (caching issue?) Needs work . That ticket is specific to the taxonomy term filter when the exposed filters are not displayed in a block. Applying the (working) patch in that issue will not resolve this issue.

Proposed resolution

The \Drupal\views\Plugin\BlockViewsExposedFilterBlock plugin inherits the cache contexts of the views display handler. This doesn't appear to be the case yet for cache tags.

🐛 Bug report
Status

Closed: outdated

Version

11.0 🔥

Component

views.module

Created by

🇧🇪Belgium rp7

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.

Production build 0.71.5 2024