Correct way to add/create a Livewire table column component?
I have a table that when clicked opens a modal and runs some calculations. The calculations are expensive so I do not want to do them until the button is clicked. I have a working solution, but the problem is it will break when switching views with errors such as:
Snapshot missing on Livewire component with id: R1rsgkBVrClAl8P8eYzL"
The code I have is as follows;
and components.score
looks like this:
The livewire score modal looks like this:
And all the calculations happen within the /app/Livewire/ScoreModal.php
component... As I mentioned before everything is working but I keep getting these livewire errors. I've tried adding :key
or wire:key
to wherever possible but it seems to make no difference.
I'm probably missing something obvious/simple here?1 Reply
Ok I managed to find a solution which works and gives no livewire key errors. It's kinda hacky, so if anyone can tell me the proper way it would be appreciated. What I ended up doing is keeping the TextColumn as is, then making an Action and calling that action. Like this:
inside
components.score
:
and finally the action like this:
I tried to directly call ->action('score-modal')
on the TextColumn, but it would return an error saying that score-modal
doesn't exist on ListSites
(my filament resource).