F
Filament9mo ago
shabxs

Multiple clicks create duplicate entry

When a form submit button is clicked multiple times, the form is being submitted multiple times and creating duplicate entries.. How to stop this behaviour...
5 Replies
Jim
Jim9mo ago
I have also managed to replicate this. Throttling chrome using dev tools can make this easier to replicate. When the request is sent, the form submit is disabled but inbetween the form request finishing and a redirect happening the form can be resubmitted.
Jim
Jim9mo ago
shabxs
shabxsOP8mo ago
Found any way to avoid it... ?
dissto
dissto8mo ago
Using a unique constraint on the db level in combination with database transactions could be one way to avoid the duplicate entry, but there may or may not be other caveats to it
Jim
Jim8mo ago
This is basically how the solution is solved on our end from a back end perspective indeed. Some requests are passed through with a uuid that the database wont allow duplicates of, others just use unique where you'd expect. I didnt realise transactions could be enabled panel wide, but we've just wrapped stuff in a transaction where required.
Want results from more Discord servers?
Add your server