FilamentF
Filament15mo ago
Sydd

Filter form loading time

Dear all, in resource table i have filter as a custom form, when opening form filter it's have a few seconds to load options, when using standard Select filter the response to load options is minimal ..., anybody know woh to fix or increase performance of form filter ? (I need to use form filter with reason of dependacy injection of next filter form fields) See code bellow:
public static function getTableFilters():array
    {
        return [
            //this working fine
            Tables\Filters\SelectFilter::make('customer_id')
                ->label(CustomerResource::getLabelForNameAttribute())
                ->options(fn() => Customer::getDistinctCustomersFromModelOptionsByRole(static::getModel()))
                ->preload(),

            //few 5-10 seconds to load after open filter
            Tables\Filters\Filter::make('custom')
                ->columnSpanFull()
                ->columns()
                ->form([
                    Select::make('customer_id')
                        ->label(CustomerResource::getLabelForNameAttribute())
                        ->live()
                        ->options(fn() => Customer::getDistinctCustomersFromModelOptionsByRole(static::getModel()))
                        ->preload()
                        ->afterStateUpdated(fn (Set $set) => $set('branch_id', null)),
Was this page helpful?