Skip to content

Conversation

@BenjaminCharmes
Copy link
Contributor

Closes #1453

Prevents double-clicking the submit button in modals by immediately locking it before the API responds.

Changes:

  • Changed submit button from type="submit" to type="button" with manual form submission
  • Added submitLocked flag that locks on first click
  • Use requestSubmit() with fallbacks to trigger form submission

@codecov
Copy link

codecov bot commented Nov 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.46%. Comparing base (c588dcb) to head (037be16).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1455      +/-   ##
==========================================
- Coverage   79.52%   79.46%   -0.06%     
==========================================
  Files          70       70              
  Lines        5000     5055      +55     
==========================================
+ Hits         3976     4017      +41     
- Misses       1024     1038      +14     

see 2 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@cypress
Copy link

cypress bot commented Nov 25, 2025

datalab    Run #4257

Run Properties:  status check passed Passed #4257  •  git commit 250e200aa1 ℹ️: Merge 037be1681f9013b82f615c422a67fe94488a900f into 936e6b7cb4eff66b3521f6196201...
Project datalab
Branch Review bc/double-submit
Run status status check passed Passed #4257
Run duration 08m 35s
Commit git commit 250e200aa1 ℹ️: Merge 037be1681f9013b82f615c422a67fe94488a900f into 936e6b7cb4eff66b3521f6196201...
Committer Ben Charmes
View all properties for this run ↗︎

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 456
View all changes introduced in this branch ↗︎

@BenjaminCharmes BenjaminCharmes marked this pull request as ready for review November 25, 2025 14:38
Copy link
Member

@ml-evs ml-evs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this @BenjaminCharmes!

Couple of points that we are discussing as I type:

  • this approach looks good as it works for all modals, but the lockAndSubmit method needs some comments to help me understand it for the future
  • also the original bug behaviour is a bit strange -- the duplicate items seem to disappear on refresh, indicating that the API requests are never actually made, so this may need to be fixed elsewhere too

@BenjaminCharmes
Copy link
Contributor Author

Couple of points that we are discussing as I type:

  • this approach looks good as it works for all modals, but the lockAndSubmit method needs some comments to help me understand it for the future

You're right, the previous approach was overkill. This event-based solution is much easier.

@BenjaminCharmes
Copy link
Contributor Author

  • also the original bug behaviour is a bit strange -- the duplicate items seem to disappear on refresh, indicating that the API requests are never actually made, so this may need to be fixed elsewhere too

Looks like both API requests succeed (when using automatic ID generation), items are just sorted differently after refresh but still exist in the database.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Disable create button in modal after clicking it

3 participants