Prevent checking a form multiple times during a single submit

Created on 20 March 2024, 3 months ago

Problem/Motivation

We've set the threshold to 50, but it's actually getting hit after only 15 submits. This happens because form validation happens multiple times during a single submit (actually 4 times). While each site should work to prevent multiple validations, it's pretty common, and IMO this module should only count each click of the submit button once, not each time validation fires within a single thread.

Steps to reproduce

We have a form being validated 4 times. We use twig_tweak and views. We have a page that adds the views exposed filter using twig_tweak's drupal_block() directive. Twig tweak validates the form twice and views validates it again twice. I'm not sure why it's happening twice for each of these.

Proposed resolution

Add a static variable to prevent multiple checks during a single submit.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States douggreen Winchester, VA

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

Merge Requests

Comments & Activities

Production build 0.69.0 2024