Have to click action twice in component

Hi all,

Strange one - I have a table with an action. The action opens up my livewire component, which just contains a table (for now). The table in the component then has it's own actions (attach) with requires confirmation set.

The issue I have is that I have to click the attach action twice in order for the confirmation to appear. As you can see in the video, the loading icon spins and then it does nothing. If I click again, it works as it should.

The first action looks like this:

Action::make('attach')
   ->label('Find')
   ->icon(Fa::getIcon('magnifying-glass-plus'))
   ->modalContent(fn(Model $record) => view('filament.components.attach-modal', ['record' => $record]))

This looks at my component view

@livewire('attach-modal', ['record' => $record])


Which loads my livewire component AttachModal where a table() method is used to generate the table with an action which is simply

Tables\Actions\Action::make('attach')
    ->button()
    ->action(function (Model $record, Action $action) {
        // Do something
    })
    ->requiresConfirmation()


and a render() method

return view('livewire.attach-modal');


I found I had to register the component in the AppServiceProvider too

Livewire::component('attach-modal', AttacModal::class);


I guess the 2 questions are:

  1. Is this the correct way to add custom components to filament?
  2. What's causing me having to click on the attach action twice for the confirmation to appear?
Thanks!
Solution
Try @livewire('attach-modal', ['record' => $record, 'lazy' => true])
Was this page helpful?