Additional changes needed to fix caching issues in Drupal 11

Created on 2 December 2025, 22 days ago

Problem/Motivation

πŸ› Form build caching is broken in Drupal 11 Active addressed some caching bugs caused by this core change in Drupal 11 πŸ“Œ Form tokens are now rendered lazily, allow forms to opt in to be cacheable Needs review , but it didn't solve all the issues.

See my comment in the other issue for a more detailed explanation πŸ› Form build caching is broken in Drupal 11 Active .

Steps to reproduce

  1. Spin up a new Drupal 11 test site
  2. Install Webform 6.3.x
  3. Enable the dynamic_page_cache module
  4. Create a Webform "Test Webform", can just be a single checkbox field.
  5. Under the webforms Settings -> Submissions, set Submission limit settings -> Per user -> Per user submission limit to be 1
  6. Create 2 new user accounts, "user1" and "user2" (no roles needed)
  7. Add the webform as a block on a page somewhere on the site
  8. Submit form as "user1". Visit form again and observe you get message indicating form is closed (good).
  9. Visit form as "user2". Get message indicating form is closed (bad). This closed message was cached by user1's request and it shouldn't have been.

Proposed resolution

Short term, for authenticated users, ensure that max-age=0 is set on the form. This restores behavior that Drupal 10 had.

Longer term, we need to ensure all the proper cache contexts are set on the form in every situation. These means examining all code paths that depend on some external context (user data, query string params, url, etc). It's very likely we're missing a bunch and were getting away with it because core was making the entire form uncacheable. We for sure know we were missing the user cache context which led to this bug that πŸ› Form build caching is broken in Drupal 11 Active attempted to fix. The fix there added the cache contexts in the wrong area though so that at least needs to be fixed.

Remaining tasks

User interface changes

API changes

Data model changes

πŸ› Bug report
Status

Active

Version

6.3

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States bkosborne New Jersey, USA

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

Merge Requests

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