Register Hooks in a custom page

Hello,
I use https://github.com/saade/filament-fullcalendar and i got a problem when i want to show the widget in a custom page.
I registered a new hook like this :
// AgencyPanelProvider.php
class AgencyPanelProvider extends PanelProvider
{
    public function boot(): void
    {
        FilamentView::registerRenderHook(
            'test::test',
            fn (): string => Blade::render('@livewire(\'' . CalendarWidget::class . '\')'),
        );
    }
}

I also have a in my blade :
// view.blade.php
{{  \Filament\Support\Facades\FilamentView::renderHook('test::test') }}

The widget appear.
I need to configure the widget with an eloquent query based on the current record.
    public function fetchEvents(array $fetchInfo): array
    {
        $record = isset($this->record);

        return Event::query()
            ->when($record, function ($query) {
                $query->where('property_id', $this->record->id);
            })
            ->get()
            ->map(function (Event $event) {           
                $title = $event->label->name . ' | ' . $event->property->name;
              
                return [
                    'id' => $event->id,
                    'title' => $title,
                    'start' => $event->start->format('Y-m-d'),
                    'end' => $event->end->format('Y-m-d')           
                ];
            })
            ->toArray();
    }

As you can see, i try to form my query with a when based on the record.
Except that my recording is not loaded. It's as if the widget was rendered before the blade and the current recording. As a result, I don't have access to the record and my request isn't being formed correctly.

What's wrong with my code?
Have I missed something with the life cycle?
Was this page helpful?