F
Filament2w 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)),

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)),

0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server