F
Filament3mo ago
Connor

Unable to find component

I have a package where I am attempting to implement a custom page in filament
<?php

namespace CNRP\InstagramFeed\Filament\Pages;

use Filament\Pages\Page;
use Filament\Forms\Form;
use Filament\Actions\Action;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Log;

class InstagramManager extends Page
{

protected static ?string $navigationIcon = 'heroicon-o-camera';
protected static ?string $navigationLabel = 'Instagram Feed';
protected static ?string $title = 'Manage Instagram Feed';
protected static ?string $slug = 'instagram-feed';
protected static string $view = 'instagram-feed::filament.pages.manage-instagram-feed';

public function mount(): void
{
}

protected function getHeaderActions(): array
{
return [
Action::make('refreshFeed')
->label('Refresh Feed')
->action('refreshFeed'),
];
}

public function refreshFeed(): void
{
// do something here
}

}
<?php

namespace CNRP\InstagramFeed\Filament\Pages;

use Filament\Pages\Page;
use Filament\Forms\Form;
use Filament\Actions\Action;
use Filament\Notifications\Notification;
use Illuminate\Support\Facades\Log;

class InstagramManager extends Page
{

protected static ?string $navigationIcon = 'heroicon-o-camera';
protected static ?string $navigationLabel = 'Instagram Feed';
protected static ?string $title = 'Manage Instagram Feed';
protected static ?string $slug = 'instagram-feed';
protected static string $view = 'instagram-feed::filament.pages.manage-instagram-feed';

public function mount(): void
{
}

protected function getHeaderActions(): array
{
return [
Action::make('refreshFeed')
->label('Refresh Feed')
->action('refreshFeed'),
];
}

public function refreshFeed(): void
{
// do something here
}

}
The page loads correctly, I see the button for refreshing feed, however clicking it gives me the error
Unable to find component: [c-n-r-p.instagram-feed.filament.pages.instagram-manager]
Unable to find component: [c-n-r-p.instagram-feed.filament.pages.instagram-manager]
I have the page registered in the boot of my package.
Filament::registerPages([
InstagramManager::class,
]);
Filament::registerPages([
InstagramManager::class,
]);
I cannot get any buttons/ actions to work, maybe due to how I'm adding the page as part of a package? Not sure where to go from here so any help would be appreciated.
6 Replies
awcodes
awcodes3mo ago
Looks like a namespacing issue. Are you using panels?
Connor
Connor3mo ago
I am using a panel for the view I believe you are probably right there, im not very familiar with this side of filament
awcodes
awcodes3mo ago
If you’re using panels then they should be automatically registered, so no need to register the page manually.
Connor
Connor3mo ago
The goal was to insert the filament page into the project via my package instagram-feed thus adding it when the package loads, is it not possible to keep this external in the package without publishing views etc?
awcodes
awcodes3mo ago
What I’m getting at is the ‘c-n-‘ etc that livewire is trying to register the component as. Also, you shouldn’t be registering it with registerPages() the plugin should take the current panel register it with $panel->pages() Iirc Would need to see more code to be sure of what you are doing.
Connor
Connor3mo ago
I believe the the c-n-r-p was some sort of converting of the namespace between where I'm creating the "page" https://github.com/CNRP/laravel-instagram-feed/blob/main/src/Filament/Pages/InstagramManager.php its defined in there as
protected static string $view = 'instagram-feed::filament.pages.manage-instagram-feed';
protected static string $view = 'instagram-feed::filament.pages.manage-instagram-feed';
I think I am missing something here obviously, though late for me so I will try again tomorrow! Thanks for the help anyway, if you have any suggestions on what I can look into I would appreciate it.
GitHub
laravel-instagram-feed/src/Filament/Pages/InstagramManager.php at m...
Contribute to CNRP/laravel-instagram-feed development by creating an account on GitHub.
Want results from more Discord servers?
Add your server