Eager loaded relationship not updating after component action called
I have an action to upload a specific document, in v3 after it was called, my custom entry could use that newly created document via
$model->documents
but in v4 it does not update.
It's like in v3 the whole model would be refreshed including eager loaded relations, but now the relations are cached.
I don't want to call $model->documents()->get()
because that's going to be a lot of extra database queries (I have quite a few fields), but I need the info to be fresh when an action is run to update the state of the field.
I can confirm if I unset the relation it works. But what I would ideally want is for the whole claim to be fetched when the livewire request comes in and then I can use the eager loaded relation throught my infolist schema.
Any ideas as to how I could combat this?
TextEntry:
Solution:Jump to solution
Fixed by calling
$model->refresh();
after my action is completed. I guess in v3 the caching was more lax, but in v4 it does not refresh the relations etc so you have to do that yourself.1 Reply
Solution
Fixed by calling
$model->refresh();
after my action is completed. I guess in v3 the caching was more lax, but in v4 it does not refresh the relations etc so you have to do that yourself.