Radio default not working on form widget

I have a widget with a form in it and it has radio buttons. I can't seem to get the default to work. I've tried adding a mount method and setting it there, I've tried adding a mutateFormDataBeforeFill method as well and that doesn't work either. Not sure what I'm doing wrong.

class DataFilter extends Widget implements HasForms
{
    use InteractsWithForms;

    public ?array $data = [];

    public function form(Form $form): Form
    {
        return $form->schema([
                Radio::make('location_filter')
                    ->label('')
                    ->inline()
                    ->options(function () {
                        $array = ['all' => 'All locations'];
                        $members = Filament::getTenant()->members->where('role_id', 3);
                        foreach ($members as $member) {
                            $array[$member->id] = $member->fullName;
                        }
                        return $array;
                    })
                    ->required()
                    ->default('all')
                    ->live()
                    ->columnSpan('full')
            
        ]);
    }
}


I had a similar problem the other day with a resource class, but trying the same fix here doesn't seem to work.
Solution
I was missing $form->statePath('data') apparently.
Was this page helpful?