FilamentF
Filament9mo ago
dwiser

Header actions on "another" View page broken

What I did:
I created another view page as outlined in the docs here: https://filamentphp.com/docs/3.x/panels/resources/viewing-records#creating-another-view-page
php artisan make:filament-page ViewRequestApproval --resource=RequestResource --type=ViewRecord

I also added actions to the page header as outlined in the docs here: https://filamentphp.com/docs/3.x/panels/pages#header-actions

What happens:
When I click the action button, I get an "Unable to find component: error".

What I tried:
  • Moving the same page between resources seems to cause the same problem no matter what resource the page and action is nested under.
  • An action with a ->url() seems to redirect fine but any ->form() or ->action() method seems to cause the same error about a missing component.
  • Adding the Action to a standard ViewResource page gives the same error.
Code Reference
In App\Filament\App\Resources\RequestResource:
class RequestResource extends Resource { public static function getPages(): array { return [ 'index' => Pages\ManageRequests::route('/'), 'view-approval' => Pages\ViewRequestApproval::route('/{record}/approval'), ]; } }

In App\Filament\App\Resources\RequestResource\Pages\ViewRequestApproval:
class ViewRequestApproval extends ViewRecord { protected function getHeaderActions(): array { return [ \Filament\Actions\Action::make('approve') ->action(function (Request $record) { dump($record); $record->approve(); $this->refreshFormData([ 'status', ]); }) ]; } }

Error message:
Unable to find component: [app.filament.app.resources.request-resource.pages.view-request-approval] vendor/livewire/livewire/src/Mechanisms/ComponentRegistry.php#116 Livewire\Exceptions\ComponentNotFoundException
Solution
I don't know what the exact cause was but php artisan filament:optimize-clear fixed the issue. Something must have been cached when setting up my local environment.
Was this page helpful?