Unable to read form values in Table Actions
I have a form that updates a data table. I'd like to create actions based on a form selection.
The actions seem to load data out of order from the life cycle.
I'm getting the values from the form correctly but using hydrate, updating, or updated to make a DB call is always one step behind what's displayed in the table.
I used Ray to dump the contents of my actions and I can see the correct data.
When getTableActions is called, the component properties are all at their default values of null or empty arrays.
10 Replies
Not sure if this helps explain the issue a bit better.
I think actions are loaded in a limbo before the livewire lifecycles can get to it.
In this one, Bart is now represented but lisa is not, Removing bart or lisa results in both of them showing on the actions.
Would this be possible with Flament 3?
I'm not sure I get what you're trying to do here, can you share more code from this page?
@pboivin I'll see what I can do. there's a lot going on π
@pboivin I hope this helps, I stripped out a bunch of stuff but I think the idea is still here.
https://gist.github.com/adampatterson/c217073a35880993670760657f6130b7
Thanks, I think I have a better picture. So if I understand correctly, when you change the values in the
Swimmer
filter, the table actions should be updated to reflect that, but currently they are not updated right away? They get updated on the next Livewire request?That's correct.
When I was looking into this I used a dump inside of
getRegistrationActions
and it loads first empty, and then loads populated.Hmm... I'm not sure but maybe you could force the table to refresh (Livewire's
$refresh
) after the form field is updated
Something to try
https://discord.com/channels/883083792112300104/1133741620320276532/1133838813693747382Humm, OK. I might to crate a custom column or I guess try the $refresh
That did work, it's not really ideal as it's doubling up the calls when you make a change. but it does accomplish what I needed.
I agree it's not ideal, I'm rarely using it.