F
Filamentβ€’5mo ago
jw

Toggle visibility on Form Field is slow

Hello, Firstly thanks for a great product, really enjoying using it. As per the attached video, when I'm toggling the visibility of a form field using Livewire, it is taking around 1 second for the UI to respond. I can see that it is hitting the database each time it makes the livewire request. Although the database request is fast, it feels unnecessary when I just want to toggle the visibility. If the livewire request can't be sped up, is it possible to toggle the visibility of the form fields using client-side Javascript? Many thanks for your assistance
Solution:
Hi again, it seems the speed delay was from using the WAMP stack on windows. I moved my development to 'Laravel Sail' and the livewire round trip reduced to about 60ms.
Jump to solution
5 Replies
Dennis Koch
Dennis Kochβ€’5mo ago
It's how Livewire works. It rerenders the whole UI when you click the button and then diffs the existing one. Over 1 seconds for a simple form is still a lot of time. Should be more around 300-400ms
jw
jwβ€’5mo ago
Thanks for your reply. Understood. I installed opcache and it's closer to 500 ms. In these situations is it possible to call a js function instead?
Dennis Koch
Dennis Kochβ€’5mo ago
Yes. If you build the component yourself πŸ˜…
Solution
jw
jwβ€’5mo ago
Hi again, it seems the speed delay was from using the WAMP stack on windows. I moved my development to 'Laravel Sail' and the livewire round trip reduced to about 60ms.
jw
jwβ€’5mo ago
I also create a new LAMP server on AWS and it ran at about 150ms round trip. I'll continue adding libraries (such as spatie/permission) and see if the speed keeps up. After adding more libraries it still seems fast. I also ran 'php artisan icons:cache' which reduced the livewire roundtrip to about 75ms Thanks again for your fast response and great product