Best practices to improve performance
How can improve performance of resources big form or repeater form or custom page form
...
Can I use computed-properties in resources to store some select options that can be limited not big of select options call it on boot function class
that come from database also can get it by js
https://livewire.laravel.com/docs/computed-properties.
We need if you can help me to guide of the best practices
....
5 Replies
We need to see the form really. First things first, all selects to be closures to avoid looping
Conditions use JS where possible to reduce network requests with the forms, as per visibleJs() on:
https://filamentphp.com/docs/4.x/forms/overview
Any SQL Queries you can natively cache if they won't change, say 15 minute.
I managed to get this relational multiple select to run without probing the server. I guess when overriding the saving and loading the component does not request from the server, not sure exactly.
Field in TaskForm, to Select one or more Users that are Assigned To the task...
The best solution do it by my self store options array in static variable property . Set and get value of property by static method call get method in options functions select::make('field')->options(self::getFieldOptions())
We need by filement to can add custom properties cached during form handling can set it in boot function destroy value of this properties after form completed saved or redirected or by method can set it in class form . Is this feature existing in filament 4
It is a livewire component in all filament areas, so you should be able to use computed properties. But also make sure options are enclosed in closures for performance:
->options(fn() => $staffSelectOptions)
it's calling closure yes .
But livewire computed properties not static properties object properties how can get current instance of form class if my class form in schemes folder or current instances of resource or custom page