F
Filamentβ€’15mo ago
adam

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.
No description
10 Replies
adam
adamOPβ€’15mo ago
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.
No description
adam
adamOPβ€’15mo ago
In this one, Bart is now represented but lisa is not, Removing bart or lisa results in both of them showing on the actions.
No description
adam
adamOPβ€’15mo ago
Would this be possible with Flament 3?
Patrick Boivin
Patrick Boivinβ€’15mo ago
I'm not sure I get what you're trying to do here, can you share more code from this page?
adam
adamOPβ€’15mo ago
@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
Patrick Boivin
Patrick Boivinβ€’15mo ago
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?
adam
adamOPβ€’15mo ago
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.
Patrick Boivin
Patrick Boivinβ€’15mo ago
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/1133838813693747382
adam
adamOPβ€’15mo ago
Humm, 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.
Patrick Boivin
Patrick Boivinβ€’15mo ago
I agree it's not ideal, I'm rarely using it.
Want results from more Discord servers?
Add your server