REMOVE DELAY WHILE TYPING ON LIVE() and AFTERSTATEUPDATED()
Forms\Components\TextInput::make('firstname')
->required(true)
->maxLength(50)
->label('First Name')
->placeholder('First Name')
->live()
->afterStateUpdated(fn ($state, callable $set, $get) => $set('fullname', static::generateFullName($state, $get('middlename'), $get('lastname'), $get('extensionname')))),
how can i remove the delay while typing on textinput on live() and ->afterStateUpdated()
how can i remove the delay while typing on textinput on live() and ->afterStateUpdated()
7 Replies
With
live()
on a TextInput it will send a network request for every character typed. Is the delay simply the time it's taking for the request to hit the server?my exact problem:
i just want to auto update the fullname, based on firstname, middlename, lastname, extension, automatically
Just use
->live(onBlur: true)
i dont see no benefit of it being immediately put there 🤔or ->lazy()
debounce
is another opt but in this case I prefer onblur
https://filamentphp.com/docs/3.x/forms/advanced#debouncing-reactive-fieldsTHANK YOU SO MUCH GUYS.
->live(onBlur: true) is the solution