May 28, 2025
0
Level 1
Filament 3.3 ->replaceMountedAction throws Uncaught TypeError: Cannot read properties of undefined (reading 'dispatchEvent'). Any workarounds?
"filament/filament": "^3.3", "laravel/framework": "^12.0",
I'm trying to fire another action after a first action is finished. I did everything according to the docs, and there's a JS error after clicking the button with an action: Uncaught TypeError: Cannot read properties of undefined (reading 'dispatchEvent'). Are there any known workarounds? Seems like an issue with filament.
I was following: (Chaining actions section) https://filamentphp.com/docs/3.x/actions/adding-an-action-to-a-livewire-component
The code:
<?php
namespace App\Filament\Resources\ProductResource\Pages;
use App\Filament\Resources\ProductResource;
use Filament\Forms\Form;
use Filament\Resources\Pages\CreateRecord;
class CreateProduct extends CreateRecord
{
protected static string $resource = ProductResource::class;
public function form(Form $form): \Filament\Forms\Form
{
return $form->schema([
\Filament\Forms\Components\Actions::make([
\Filament\Forms\Components\Actions\Action::make('exampleValidateAndPreview')
->label(__('Validate and Preview'))
->action(function () {
$this->replaceMountedAction('showPreview');
})
->color('primary'),
])
]);
}
public function showPreviewAction(): \Filament\Actions\Action
{
return \Filament\Actions\Action::make('showPreview')
->requiresConfirmation()
->action(function () {
// Some logic here
});
}
}
Please or to participate in this conversation.