-
Notifications
You must be signed in to change notification settings - Fork 25
Prevent double-click on modal submit button #1455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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 🚀 New features to boost your workflow:
|
datalab
|
||||||||||||||||||||||||||||
| Project |
datalab
|
| Branch Review |
bc/double-submit
|
| Run status |
|
| Run duration | 08m 35s |
| Commit |
|
| Committer | Ben Charmes |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
0
|
|
|
456
|
| View all changes introduced in this branch ↗︎ | |
5caf545 to
0395c46
Compare
ml-evs
left a comment
There was a problem hiding this 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
You're right, the previous approach was overkill. This event-based solution is much easier. |
Looks like both API requests succeed (when using automatic ID generation), items are just sorted differently after refresh but still exist in the database. |
Closes #1453
Prevents double-clicking the submit button in modals by immediately locking it before the API responds.
Changes:
type="submit"totype="button"with manual form submissionsubmitLockedflag that locks on first clickrequestSubmit()with fallbacks to trigger form submission