F
Filament5mo ago
swilla

Dynamically loaded Widgets do not refresh when changing filters on the page

I'm loading widgets on a page like this:
public function getWidgets(): array
{
$communityFilter = $this->filters['communityId'] ?? null;
$community = Community::find($communityFilter) ?? auth()->user()->community;

$community->load('metrics');

return $community->metrics->map(function ($metric) {
return MetricWidget::make([
'headering' => $metric->title,
'metric' => $metric,
]);
})->toArray();
}
public function getWidgets(): array
{
$communityFilter = $this->filters['communityId'] ?? null;
$community = Community::find($communityFilter) ?? auth()->user()->community;

$community->load('metrics');

return $community->metrics->map(function ($metric) {
return MetricWidget::make([
'headering' => $metric->title,
'metric' => $metric,
]);
})->toArray();
}
I have a FilterAction setup to allow selecing a community. The dynamic headers I setup work, but the MetricWidgets never reload with the new widget. Is there a way to clear these and re-add them on filter change or force a refresh?
No description
0 Replies
No replies yetBe the first to reply to this messageJoin