Toggle afterStateUpdated not getting fired

public function form(Form $form): Form
    {
        return $form->schema([
            Toggle::make('showUnmatched')
                ->label('Show')
                ->onColor('primary')
                ->offColor('gray')
                ->afterStateUpdated(function (?string $state, ?string $old) {
                    Log::debug($state);
                    Log::debug($old);
                })
        ]);
    }


I don't get anything logged when I use the afterStateUpdated method. I'dl ike to be able to save the state in the session but it doesn't seem to be getting fired at all. Suggestions? It's not tied to a field in my database, it's just a toggle I'm using to show/hide a section on the page.
Solution
add ->live()
Was this page helpful?