filamentphp / filament

A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
https://filamentphp.com
MIT License
19.3k stars 2.96k forks source link

live() Select multiple options re-appear when removing quickly on relationship data #9844

Closed mohdaftab closed 12 months ago

mohdaftab commented 12 months ago

Package

filament/forms

Package Version

^3.0-stable

Laravel Version

^10.0

Livewire Version

V3.0.0

PHP Version

PHP 8.1

Problem description

I am using multiple (live - important) Select Component with multiple select and preload in my form and the issue I am facing is when I have some options selected and I want to remove some of them by clicking on x button quickly then it hits the server as expected but if I click them one by one quickly some of them re-appear in the options. It works a bit better on local but the production server is a bit slower and we face this issue all the time.

Thank you

Expected behavior

Is it possible to make live only when blur like on TextInput ->live(onBlur: true) or disable removing item until the previous request is complete please?

Thank you

Steps to reproduce

  1. Please install this repository linked in this issue, migrate and add a user.
  2. Run php artisan db:seed
  3. Go to Buyers page and click on add a new buyer
  4. Now here we can see 3 Select components, Regions, Industries, Revenue Ranges please select 15 to 20 from the preloaded items.
  5. Now the real problem is when we quickly remove items from the list, I have used the 4 characters so that clicking quickly is easy to do, there you can see the options sometimes re-appear while removing other items, this is where I need to fix this. This is a really simple form and it still has the issue but I am using more forms which has whereIn("id",[1,2,3]) as well as whereNotIn("id",[4,5,6]) queries which are dependent on a few live TextInputs so I can't remove the live option from here.

Thank you

Reproduction repository

https://github.com/mohdaftab/filamentphp-mohdaftab

Relevant log output

N/A
mohdaftab commented 12 months ago

https://github.com/filamentphp/filament/assets/25055576/91390ebc-ff83-4bd0-8ffd-dbeb853f22ce

Please check this video for reference. Thank you

tonypartridge commented 12 months ago

looking at the code, it looks to be a livewire issue given we are not doing a live call. We will test this, but can you please update with your exact livewire version? 3.0.0 is old now it is on 3.2.1. and filamentphp version, 3.0-stable isn't the version you are on now.

Thanks

mohdaftab commented 12 months ago

Hello @tonypartridge This is what I see in the composer.lock file

"livewire/livewire": "^3.0", "livewire/volt": "^1.3", "orchestra/testbench": "^7.0|^8.0", "phpunit/phpunit": "^9.0|^10.0"

mohdaftab commented 12 months ago

I updated the livewire version using php artisan livewire:update and it asked me so many questions and asked to make changes with Before/After code and it seems to be working fine now. I will try to update my production project and see how it goes.

Thank you so much.

mohdaftab commented 12 months ago

@tonypartridge turns out my production server had Livewire 2 somehow working with Filament v3 but I have now updated it. I just wanted to confirm that the changes it asked me to do will be automatically fixed on the Filament version and I just have to fix them on my front-end which I coded myself? Thank you

tonypartridge commented 11 months ago

@tonypartridge turns out my production server had Livewire 2 somehow working with Filament v3 but I have now updated it. I just wanted to confirm that the changes it asked me to do will be automatically fixed on the Filament version and I just have to fix them on my front-end which I coded myself? Thank you

That is standard livewire upgrade, filament doesn't have livewire which is why we advise you do it.