F
Filament5mo ago
Baspa

Unable to find component when clicking on an action

I have a custom action in a custom Filament page:
// ...
use Filament\Actions\Action;
// ...

class LoginTwoFactor extends Page implements HasForms, HasActions
{
use InteractsWithForms;
use InteractsWithFormActions;

protected static string $layout = 'filament.layouts.login';

public function mount(): void
{
$this->form->fill();
}

public function resendAction(): Action
{
return Action::make('resend')
->label('Opnieuw versturen')
->color('info')
->action(function ($data) {

auth()->user->notify(app(SendOTP::class));
});
}

// ...
}
// ...
use Filament\Actions\Action;
// ...

class LoginTwoFactor extends Page implements HasForms, HasActions
{
use InteractsWithForms;
use InteractsWithFormActions;

protected static string $layout = 'filament.layouts.login';

public function mount(): void
{
$this->form->fill();
}

public function resendAction(): Action
{
return Action::make('resend')
->label('Opnieuw versturen')
->color('info')
->action(function ($data) {

auth()->user->notify(app(SendOTP::class));
});
}

// ...
}
When I click on the action button it gives me the following error:
Unable to find component: [app.filament.pages.auth.login-two-factor]
To me it's totally unclear where this message comes from. I never reference the mentioned view? Can someone explain to me what's actually happening? If you need more code or information I will provide it.
2 Replies
Baspa
BaspaOP5mo ago
I see a similar question here: https://www.answeroverflow.com/m/1169485158752198746 but the path of my component seems right, it's in the App\Filament\Pages\Auth directory and is called LoginTwoFactor
Livewire\Exceptions\ComponentNotFoundException issue - Filament
I am facing an error i.e. Unable to find component: [app.filament.resources.appraisal-response-resource.pages.appraisal-response-request] . This error is occurring when the page is loading for the first time, when refreshing the page, when i try to update any field and when I click on the save button. Please help me to solve this issue. Thank ...
Baspa
BaspaOP5mo ago
Hmm, moving the class to the Livewire/Auth directory helped me. But how can I keep the pages in the App\Filament\Pages\Auth directory. Or is that not possible? I already registered the component in my FortifyServiceProvider like this: Livewire::component((new LoginTwoFactor())->getName(), LoginTwoFactor::class); But that did not seem to help 🤔
Want results from more Discord servers?
Add your server