afterStateHydrated not working when using multiple Fieldset
i'm trying to use afterStateHydrated on FieldA in Fieldset1 to update FieldB in Fieldset2, this does not work. When doing the same when FieldA and FieldB are in the same Fieldset1, then it works fine.
18 Replies
share some code you are trying please
same issue here: country_id is being set to null, but id and status are not.
->live() for it to trigger afterState
I'm sorry, ->live() is already in the code, I accidentally deleted it when formatting it here
I've also tried some "hacks", like
->live(debounce:150)
->native(false)
->searchable()
as suggested by Dan here (https://github.com/filamentphp/filament/issues/8368) but to no avail
GitHub
$set in afterStateUpdated on select with scoped relationship not wo...
Package filament/filament Package Version 3.0.42 Laravel Version 10.22.0 Livewire Version No response PHP Version 8.2.9 Problem description I'm trying to set the property select to the customer...
You can'd do it like that, I think you need to name the fieldset and sub set them to null. Since you are going into the fieldset as a relationship.
if you dd ($get()) check what you get
first of all, thank you guys so much for the prompt replies, you're real heroes!
so I've renamed the Fieldset to 'deal_info'
as a clarification, this is in a Relation Manager
Where are you doing the get?
Is that select a relationship? If so traverse out? ../
dd($get('../deal_info'));
dd($get('../deal_info.status'));
both return null
account_deal_id
then I get the correct id from what I just selected, equal to $state
Hey, wow, I got it
I think you were on the right track. It wasn't about targetting the name of the Fieldset, but the relationship(?)
Yeah along those lines, it's tricky to work it out when inbetween snippets of code
Solution
so I can basically call the Fieldset anything really, but then $get its fields through the ->relationship
Yes that makes sense
if you did not define the relationship it then groups it onto the fieldset name
Ahhh I see, makes sense
Thanks a lot for the support, toeknee!