Calculated State Typed property Filament\Forms\Components\Component::$container must not be accessed

In my UserResource class, I'm attempting to populate a toggle based on the soft delete flag on the user table. I have this in my model:
  public function isActive(): bool
    {
        return is_null($this->deleted_at);
    }

and this in my UserResource form:

  Toggle::make('active')->state(function (?User $record): bool {
                        return $record->isActive();
                    }),


I'm getting the error
Typed property Filament\Forms\Components\Component::$container must not be accessed before initialization
.

Not sure what I'm doing wrong, as doing something similar on another resource worked fine.
Was this page helpful?