Form with fields that have ->reactive and afterStateUpdated
Hello,
I've just made a comparison between a code running in a v3 form and same code running in v4 form.
Results are kinda disapointing
While in v3 my fields hide/show instantly in v4, it takes about 1-2 seconds to hide/show
Was there any big change made on v4 in matter of forms?
4 Replies
So you don't actually need a request anymore.
https://filamentphp.com/content/leandrocfe-whats-new-in-filament-v4#using-javascript-to-minimise-network-requests
And:
https://filamentphp.com/docs/4.x/infolists/overview#hiding-an-entry-using-javascript
Filament
What's new in Filament v4? - Feature Overview by Leandro Ferreira -...
A collection of beautiful full-stack components for Laravel. The perfect starting point for your next app. Using Livewire, Alpine.js and Tailwind CSS.
I would also look at your network requests though, you may have more functions or queries depending on your integration.
you mean that in v4 using ->visible() and ->afterStateUpdate() are now slower, and I should use visibleJs and afterStateUpdateJs instead?
If you can you should. If the logic is just based on the state data in the schema, then yes, do that. If you have to do a lookup to the database, or an api call, then that won't work, of course.