RepeatableEntry not updating after updating Relationship

I have a basic repeater that uses the documents relationship like so:
RepeatableEntry::make('documents')
->schema([
TextEntry::make('name'),
])
RepeatableEntry::make('documents')
->schema([
TextEntry::make('name'),
])
public function documents(): HasMany
{
return $this->hasMany(Document::class);
}
public function documents(): HasMany
{
return $this->hasMany(Document::class);
}
But when I run an action that uploads a document, adding to the documents relationship, the repeatable entry does not update. Am I doing something wrong?
Solution:
Something like: $this->dispatch('refreshData'); // In your Livewire page class...
Jump to solution
5 Replies
toeknee
toeknee5w ago
I assume it shows when you refresh?
Harvey
HarveyOP5w ago
Yep
toeknee
toeknee5w ago
Yeah that's how info lists are because they are after, you ideally don't want them refreshing continously as it casues extra load. However, you could probably add a watcher onto it for triggered a refresh after state was updated.
Solution
toeknee
toeknee5w ago
Something like: $this->dispatch('refreshData'); // In your Livewire page class use Livewire\Attributes\On; #[On('refreshData')] public function refresh(): void { // Livewire will automatically refresh the component }
Harvey
HarveyOP5w ago
Thanks, will give it a go

Did you find this page helpful?