Closed jordanmiguel closed 1 day ago
This is not the intended behaviour so it's not really a bug, "hydration" is the process of filling the form with predefined/default values and ensuring anything without a value still exists in the state. $set()
is a method used for state updates, not hydration. I think in v4 there is an option to call afterStateUpdated()
from a $set()
Package
filament/filament
Package Version
v3
Laravel Version
v11
Livewire Version
v3
PHP Version
PHP 8.3
Problem description
I'm using https://filamentphp.com/plugins/leandrocfe-brazilian-form-fields to fill out address information based on the zip code. When a zip code is fetched, it updates fields with the zip information.
But for the state_id, I need to hydrate the info (it comes as a CODE, example: NY), and find the state in the DB (State::where('code', $code)->id).
The thing is, when state_id is updated with the CODE using $set, or any other field (if I select other field to be updated), afterStateHydrated is not being called, as well as afterStateUpdated. Both fields already have ->live() attribute.
Expected behavior
afterStateHydrated should be called when $set for the field is called.
Steps to reproduce
Reproduction repository (issue will be closed if this is not valid)
https://github.com/leandrocfe/filament-ptbr-form-fields
Relevant log output
No response
Donate 💰 to fund this issue