filament icon indicating copy to clipboard operation
filament copied to clipboard

The same form is submitted multiple times

Open wily45454545 opened this issue 2 years ago • 22 comments

Package

filament/filament

Package Version

v3.1.12

Laravel Version

v10.35.0

Livewire Version

v3.2.6

PHP Version

PHP 8.2.0

Problem description

When creating a record, clicking the Create button continuously will cause the form to be submitted repeatedly.

Expected behavior

Button keeps display loading animation and disable button until page redirects

Steps to reproduce

https://demo.filamentphp.com/blog/posts/create Clicking the Create button continuously.

Reproduction repository

https://github.com/filamentphp/demo

Relevant log output

No response

wily45454545 avatar Dec 06 '23 09:12 wily45454545

Cannot reproduce. I am continuously clicking the create button and no requests are made.

https://github.com/filamentphp/filament/assets/41773797/5d93bf38-d26f-4b81-ae4d-4c132228234f

danharrin avatar Dec 12 '23 14:12 danharrin

Multiple clicking on the submit button creates duplicates entry. I think this is a serious issue still exist on the latest version...

shabxs avatar Mar 25 '24 14:03 shabxs

Please show me how to reproduce it, check the video above

danharrin avatar Mar 25 '24 16:03 danharrin

This video shows regular click and multiple clicks.

https://github.com/filamentphp/filament/assets/14359417/35dec8f6-fd41-42ac-abd3-71f9d8418430

shabxs avatar Mar 26 '24 11:03 shabxs

i have this problem too, this happen in slow network , when form submit take long

Arsham-rmz avatar May 07 '24 18:05 Arsham-rmz

same issue here, some of my users can still click submit button after loading state, before the page refresh on slow network. I have to manually correct double entries for money transactions :D still waiting for fix :)

yesterselga avatar Jul 14 '24 15:07 yesterselga

The only reproduction repo that has been posted is the demo, in which I cannot reproduce the problem. This will remain closed until someone posts a new repo that works to reproduce the problem

danharrin avatar Jul 15 '24 14:07 danharrin

You have to add this function on class CreateClass, until this issue fixed

public function beforeCreate(){
$this->data = null;
}

ramimarashdeh1995 avatar Aug 19 '24 11:08 ramimarashdeh1995

You have to add this function on class CreateClass, until this issue fixed

public function beforeCreate(){
$this->data = null;
}

@ramimarashdeh1995

Thank you rami, it worked for me

ahmadaldabouqii avatar Aug 19 '24 14:08 ahmadaldabouqii

You have to add this function on class CreateClass, until this issue fixed

public function beforeCreate(){
$this->data = null;
}

Thats Beautiful and Thank You

shabxs avatar Aug 19 '24 17:08 shabxs

What OS and browser are you all using? I still cant get it to submit multiple times

danharrin avatar Aug 20 '24 06:08 danharrin

@danharrin Fix this issue and ping us please !

ahmadaldabouqii avatar Aug 20 '24 09:08 ahmadaldabouqii

@danharrin Fix this issue and ping us please !

dude... are you not reading what I am writing?

danharrin avatar Aug 20 '24 09:08 danharrin

@danharrin

Yup, we are using chrome last version and linux OS

ahmadaldabouqii avatar Aug 20 '24 09:08 ahmadaldabouqii

@ramimarashdeh1995 @shabxs @yesterselga @Arsham-rmz what OS are you using, I don't have Linux to test on

danharrin avatar Aug 20 '24 09:08 danharrin

@danharrin Rami has windows 11

ahmadaldabouqii avatar Aug 20 '24 09:08 ahmadaldabouqii

@ramimarashdeh1995 @shabxs @yesterselga @Arsham-rmz what OS are you using, I don't have Linux to test on

I used windows 11 and chrome browser

ramimarashdeh1995 avatar Aug 20 '24 09:08 ramimarashdeh1995

I can now get it to happen on Windows, but only if I throttle the network. A request is able to sneak through when the Livewire response arrives but before Livewire redirects the user to the next page. It seems like an bug in Livewire but it might be something we can work around within Filament.

danharrin avatar Aug 20 '24 09:08 danharrin

I can now get it to happen on Windows, but only if I throttle the network. A request is able to sneak through when the Livewire response arrives but before Livewire redirects the user to the next page. It seems like an bug in Livewire but it might be something we can work around within Filament.

What I understand is it's not a filament issue, neither livewire. Same issue occurs with regular submit actions on plain blade, including nova which is on vuejs.

As @danharrin mentioned a workaround fix on filament future releases would be great. Thanks in advance.

shabxs avatar Aug 20 '24 10:08 shabxs

Hello guys, just a confirmation that we have the same issue. Just one more stress the issue really exists.

Thanks for your work.

vbezruchkin avatar Sep 06 '24 08:09 vbezruchkin

public function beforeCreate(){ $this->data = null; }

This didn't work for me because I use 2 tables related to repeater, the main table is saved but the data from the other table is deleted I'm trying another way, but still having problems https://laravel.io/articles/preventing-duplicate-form-submissions-using-atomic-locks

eduardocm2002 avatar Oct 02 '24 15:10 eduardocm2002

Hey @polar-sh[bot]! We're sorry to hear that you've hit this issue. 💛

However, it looks like you forgot to fill in the reproduction repository URL. Can you edit your original post and then we'll look at your issue?

We need a public GitHub repository which contains a Laravel app with the minimal amount of Filament code to reproduce the problem. Please do not link to your actual project, what we need instead is a minimal reproduction in a fresh project without any unnecessary code. This means it doesn't matter if your real project is private / confidential, since we want a link to a separate, isolated reproduction. That would allow us to download it and review your bug much easier, so it can be fixed quicker. Please make sure to include a database seeder with everything we need to set the app up quickly.

github-actions[bot] avatar Mar 20 '25 17:03 github-actions[bot]