Save to DB after deleting a repeater element

I am implementing a ChatGPT-like UI. I use a Repeater to populate the list of conversations. When I press the delete icon it deletes properly the element from the array but I would have to press Submit to save the modified list into the DB. What I want is to save the array immediately after pressing the Delete button (actually this control ideally doesn't even have a submit button).

I played a bit with deleteAction object (https://filamentphp.com/docs/3.x/forms/fields/repeater#customizing-the-repeater-action-objects) but it seems it can just setup the action in specific ways instead of running code after pressing the delete button.

This is my form:
    protected function getFormSchema(): array
    {
        // dd($this->conversation);
        return [
            FilamentForms\Repeater::make('history')
            ->schema([
                FilamentForms\TextInput::make('name')
                ->readOnly(true)
                ->label('')
            ])
            ->addable(false)
            ->model($this->conversation)
            ->statePath('data')
        ];
    }
Was this page helpful?