Skip to content
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

The same form is submitted multiple times #10112

Open
wily45454545 opened this issue Dec 6, 2023 · 20 comments
Open

The same form is submitted multiple times #10112

wily45454545 opened this issue Dec 6, 2023 · 20 comments
Labels
bug Something isn't working low priority unconfirmed
Milestone

Comments

@wily45454545
Copy link

wily45454545 commented Dec 6, 2023

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

Donate 💰 to fund this issue

  • You can donate funding to this issue. We receive the money once the issue is completed & confirmed by you.
  • 100% of the funding will be distributed between the Filament core team to run all aspects of the project.
  • Thank you in advance for helping us make maintenance sustainable!
Fund with Polar
@wily45454545 wily45454545 added bug Something isn't working low priority unconfirmed labels Dec 6, 2023
@github-project-automation github-project-automation bot moved this to Todo in Roadmap Dec 6, 2023
@danharrin danharrin added this to the v3 milestone Dec 8, 2023
@danharrin
Copy link
Member

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

Screen.Recording.2023-12-12.at.14.00.22.mov

@danharrin danharrin closed this as not planned Won't fix, can't repro, duplicate, stale Dec 12, 2023
@github-project-automation github-project-automation bot moved this from Todo to Done in Roadmap Dec 12, 2023
@shabxs
Copy link

shabxs commented Mar 25, 2024

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

@danharrin
Copy link
Member

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

@shabxs
Copy link

shabxs commented Mar 26, 2024

This video shows regular click and multiple clicks.

Recording.3.mp4

@Arsham-rmz
Copy link

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

@yesterselga
Copy link

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 :)

@danharrin
Copy link
Member

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

@ramimarashdeh1995
Copy link

ramimarashdeh1995 commented Aug 19, 2024

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

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

@ahmadaldabouqii
Copy link

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

@shabxs
Copy link

shabxs commented Aug 19, 2024

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

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

Thats Beautiful and Thank You

@danharrin
Copy link
Member

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

@ahmadaldabouqii
Copy link

@danharrin
Fix this issue and ping us please !

@danharrin
Copy link
Member

@danharrin Fix this issue and ping us please !

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

@ahmadaldabouqii
Copy link

@danharrin

Yup, we are using chrome last version and linux OS

@danharrin
Copy link
Member

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

@ahmadaldabouqii
Copy link

@danharrin
Rami has windows 11

@ramimarashdeh1995
Copy link

@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

@danharrin
Copy link
Member

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 danharrin reopened this Aug 20, 2024
@github-project-automation github-project-automation bot moved this from Done to Todo in Roadmap Aug 20, 2024
@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Aug 20, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in Roadmap Aug 20, 2024
@danharrin danharrin reopened this Aug 20, 2024
@github-project-automation github-project-automation bot moved this from Done to Todo in Roadmap Aug 20, 2024
@filamentphp filamentphp deleted a comment from github-actions bot Aug 20, 2024
@shabxs
Copy link

shabxs commented Aug 20, 2024

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.

@vbezruchkin
Copy link

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

Thanks for your work.

@eduardocm2002
Copy link

eduardocm2002 commented Oct 2, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working low priority unconfirmed
Projects
Status: Todo
Development

No branches or pull requests

9 participants