Full name calculation with afterStateUpdated

Hi. I use many inputs to calculate a name. 1. How can I abstract the function called in each afterStateUpdated to one function outside (sorry for this simple question) 2. Why I can't write the "Nombre" field? afterStateUpdated regenerates "fullname" Thanks
No description
Solution:
My suggestion until v4 would be to use ->live(onBlur: true)
Jump to solution
6 Replies
awcodes
awcodes4mo ago
Looks like an issue with live() you either need to provide a reasonable debounce or defer it to onBlur. Basically, it’s getting updated before the request can return a response from livewire. This will be better in v4 where you can offload it to JS instead of depending on a full livewire request.
PabloZagni
PabloZagniOP4mo ago
Can I calculate the name BEFORE entering the fullname field?
awcodes
awcodes4mo ago
Possibly, with the right alpine methods, but I don’t think it’s totally feasible at the moment.
Solution
awcodes
awcodes4mo ago
My suggestion until v4 would be to use ->live(onBlur: true)
awcodes
awcodes4mo ago
Then it would only get run when the field is blurred. Thus only one server request.
PabloZagni
PabloZagniOP4mo ago
U rock dude
Want results from more Discord servers?
Add your server