Josh
Josh
FFilament
Created by Josh on 4/23/2024 in #❓┊help
Cleaner way to do this with render hooks?
I've got it to this point
public function boot(): void
{
FilamentView::registerRenderHook(
PanelsRenderHook::USER_MENU_BEFORE,
function () {
return "<div class='flex items-center'>" . view('filament.hooks.header-user-greeting');
}
);

FilamentView::registerRenderHook(
PanelsRenderHook::USER_MENU_AFTER,
fn () => "</div>"
);
}
public function boot(): void
{
FilamentView::registerRenderHook(
PanelsRenderHook::USER_MENU_BEFORE,
function () {
return "<div class='flex items-center'>" . view('filament.hooks.header-user-greeting');
}
);

FilamentView::registerRenderHook(
PanelsRenderHook::USER_MENU_AFTER,
fn () => "</div>"
);
}
3 replies
FFilament
Created by Josh on 11/20/2023 in #❓┊help
Snapshot Missing - View Column with Livewire Component
The Problem: I was facing an issue where Livewire components were not rendering correctly when changing the pagination state of a Filament table. Specifically, when I switched from page 2 to 'all' records, the avatars for some records weren't loading properly. The Solution: After diving into the Livewire and Filament documentation, I realised the problem was with how Livewire handles dynamic components. The key was to make each Livewire component instance unique for every render, especially when pagination states change. I used Livewire’s wire:key directive to uniquely identify each instance of my player-avatars component. The key was to include the current pagination page number in the wire:key attribute. This way, every time the page number changes, Livewire knows to re-render the component.
@livewire('player-avatars', ['uuid' => $getRecord()->minecraft_uuid, 'class' => 'w-9 h-9 mr-3 rounded-md'], key('player-avatar-' . $getRecord()->id . '-' . $this->getTableRecords()->currentPage()))
@livewire('player-avatars', ['uuid' => $getRecord()->minecraft_uuid, 'class' => 'w-9 h-9 mr-3 rounded-md'], key('player-avatar-' . $getRecord()->id . '-' . $this->getTableRecords()->currentPage()))
By appending getTableRecords()->currentPage() to the wire:key, each avatar component is now tied not only to the record's ID but also to the current page number. This ensures proper re-rendering when the pagination state changes. Why This Works: Livewire needs to uniquely identify each component instance to manage its lifecycle effectively, especially when dealing with dynamic content like pagination. By adding the current page number to the wire:key, we help Livewire understand when it needs to refresh the components, ensuring our UI stays in sync with our application's state. Hope this helps anyone who might be facing similar issues. 🚀
11 replies
FFilament
Created by Josh on 11/20/2023 in #❓┊help
Snapshot Missing - View Column with Livewire Component
Still trying to figure out what is up. Other issues with similar errors give a potential fix by using wire:key however I have; @livewire('player-avatars', ['uuid' => $getRecord()->minecraft_uuid, key('player-avatar-' . $getRecord()->id) Unsure how to fix at this stage :/
11 replies
FFilament
Created by Josh on 11/20/2023 in #❓┊help
Snapshot Missing - View Column with Livewire Component
Oops forgot the screen recording!
11 replies
FFilament
Created by Josh on 8/11/2023 in #❓┊help
Best Approach for View Customer
Just curious @awcodes how you would approach it. Keep last order as a widget and just call it on a custom page so I can position it next to an infolist or is there a better approach I’m not thinking of?
8 replies
FFilament
Created by Josh on 8/11/2023 in #❓┊help
Best Approach for View Customer
I don't know why but I am really drawing a blank at how I can get the two next to each other. See the original gist. Its because I have to edit infobuilder in the CustomerResource and the LastOrder widget in ViewCustomer. The widget is a 'Header Widget'
8 replies
FFilament
Created by Josh on 8/11/2023 in #❓┊help
Best Approach for View Customer
Cheers dude! I did Gist all the relevent parts in the OP 🙂
8 replies