[Webform block] Webform block doesn't take into account source entity when caching

Created on 2 December 2021, almost 3 years ago
Updated 8 April 2024, 7 months ago

Problem/Motivation

We noticed that on some page loads, when forms rendered are in a block on a node page, the forms don't submit on the first try and simply result in the reload of the page. On closer inspection of the site, we noticed that the node id didn't correspond with the form id.

For example, when loading /node/1059, the form's id was webform_submission_questions_node_994_add_form. Once the form was submitted the first time, the page reloaded (not submitting the form) and re-rendered the form with the correct form id webform_submission_questions_node_1059_add_form.

Steps to reproduce

Load a page with a block having a webform, then load another page, containing the webform block, and verify the form ids of the block forms.

Proposed resolution

Add caching dependency on the source entity if one exists.

Remaining tasks

Review changes.

User interface changes

None.

API changes

None, beyond fixing cache-ability of the page.

Data model changes

None.

🐛 Bug report
Status

Needs work

Version

6.2

Component

Code

Created by

🇺🇸United States richgerdes New Jersey, USA

Live updates comments and jobs are added and updated live.
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