Livewire lifecycle hooks not working in nested widget

Hey, I don't know if this is a filament specific or a livewire thing but I though I'd also ask here. Hey, I have 2 livewire components. One is called Map and has the property $filters. It is a filament page. The other is called MapWidget and get's the property from the Map component. It is a filament widget. Now I want to call code when the $filters property of the child component MapWidget updates. However the hooks don't seem to fire. Map:
<?php
class Map extends Page
{
public ?array $filters = [];

...
}
<?php
class Map extends Page
{
public ?array $filters = [];

...
}
<form wire:submit='create'>
...

<button type="submit">
Submit
</button>
</form>

<div>
@livewire(\App\Filament\Widgets\MapWidget::class, ['filters' => $filters])
</div>
<form wire:submit='create'>
...

<button type="submit">
Submit
</button>
</form>

<div>
@livewire(\App\Filament\Widgets\MapWidget::class, ['filters' => $filters])
</div>
MapWidget
class MapWidget extends Widget
{
public ?array $filters = [];

public function updated($property)
{
// $property: The name of the current property that was updated

dd($property);
}
}
class MapWidget extends Widget
{
public ?array $filters = [];

public function updated($property)
{
// $property: The name of the current property that was updated

dd($property);
}
}
When putting the updated function into the parent component it works as expected. I can also see that the data changes when I echo it in the view. The only thing not working are these hooks.
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?