afterStateHydrated - how to fill in other fields in 'create' mode?
I need to fill in some empty fields when creating a record. Set does not work if operation = create (in edit it works fine).
10 Replies
Solution
->default() ?
can't you use afterStateUpdated(function ($set) { your logic })? I think I already used it in create and it worked normally if I'm not mistaken
there is also a default... completely forgot about it - thank you!
Unfortunately, it doesn't seem to work in the create mode
do you have ->reactive() on the field you want to change?
I had an idea it worked but if not sorry for the confusion
Updated requires reactive. If your just filling it. afterStateHydrated() would be better. But on a create page default() is preferable.
true xD
I have ->live(onBlur: true)
I don't remember needing ->live on filament until now
It replaced reactive() since livewire switched to defer by default.
Makes filaments api closer to livewires.
ok thanks for the explanation