Use reactive props in widgets of a panel page

Hi, I'm trying to build a page within the panel with reactive properties like the following
class AnalyticsDashboard extends Page
{
#[Reactive]
public array $metrics = [];

#[On('updateFilters')]
public function updateData()
{
$dataset = $this->getData();

$this->metrics = Arr::get($dataset, 'metrics', []);
}

public function getWidgetData(): array
{
return [
'metrics' => $this->metrics,
];
}
...
}
class AnalyticsDashboard extends Page
{
#[Reactive]
public array $metrics = [];

#[On('updateFilters')]
public function updateData()
{
$dataset = $this->getData();

$this->metrics = Arr::get($dataset, 'metrics', []);
}

public function getWidgetData(): array
{
return [
'metrics' => $this->metrics,
];
}
...
}
When "updateFilters" event is dispatched I get the following error Cannot mutate reactive prop [metrics] in component: [app.filament.pages.analytics-dashboard] I need to mention that I tested without any widget and still get the error, the property is not mutated from the action or anywhere else than from the Page's livewire component Another thing is that I'm using Octane and unsure if it tampers livewire data but can't find anything recent or any issue opened about this so I don't really know Last trace is the following (why I thought about octane) Livewire \ Features \ SupportReactiveProps \ BaseReactive : 40 dehydrate
public function dehydrate($context)
{
if ($this->originalValueHash !== crc32(json_encode($this->getValue()))) {
>> throw new CannotMutateReactivePropException($this->component->getName(), $this->getName());
}

$context->pushMemo('props', $this->getName());

}
public function dehydrate($context)
{
if ($this->originalValueHash !== crc32(json_encode($this->getValue()))) {
>> throw new CannotMutateReactivePropException($this->component->getName(), $this->getName());
}

$context->pushMemo('props', $this->getName());

}
0 Replies
No replies yetBe the first to reply to this messageJoin