Clear RichText input after action

Hi All,

I have a table action to view details, the action opens modal which has a RichText input to update a related model, this is working fine. When I submit the form I need to clear/empty the RichText input... any ideas, Google and LLMs have not got me to a solution yet 😦

Tables\Actions\Action::make('viewDetails')
->slideOver()
->form([
    RichEditor::make('response')
        ->name('response')
        ->label('')
        ->required()
        ->afterStateUpdated(fn($state) => session()->put('response', $state))
        ->visible(fn($record) => !TicketService::isTicketClosed($record)),
])
->label('Details')
->icon('heroicon-o-eye')
->modalHeading(fn($record) => "#$record->id: $record->name ({$record->status->name})")
->modalContent(fn($record) => view('filament.actions.view-ticket-description', [
    'owner' => $record->user->name,
    'subject' => $record->name,
    'description' => $record->description,
    'time' => $record->formattedDate,
    'responses' => $record->responses()->with(['user', 'agent'])->get(),
    'copiedUsers' => $record->copiedUsers()->get(),
    'agents' => $record->agents()->with('user')->get(),
]))
->modalSubmitAction(false)
->extraModalFooterActions([
    Action::make('sendResponse')
        ->label('Send')
        ->color('primary')
        ->action(function ($record) {
            if (!TicketService::validateResponse()) return;
            TicketService::createTicketResponse($record);
            TicketService::sendNotification("Ticket updated", "Your response to ticket #$record->id was sent.");
        })
        ->visible(fn($record) => !TicketService::isTicketClosed($record)),
])
->closeModalByClickingAway(false),


Cheers, Tee
Solution
I cannot believe how stupidly simple this was to resolve... after 8 hours of smashing my head against a wall yesterday... today I tried this and it worked! :therea54BLITZ:
RichEditor::make('response')
  ->name('response')
  ->label('')
  ->required()
  ->afterStateUpdated(function ($state, $set) {
      session()->put('response', $state);
      $set('response', null); // THIS IS THE ANSWER!!!
  })
  ->visible(fn($record) => !TicketService::isTicketClosed($record)),
Was this page helpful?