© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
FilamentF
Filament•8mo ago•
12 replies
islandnuge

Prevent caching on modal popups from a table

I have table that for each row includes 3 actions that individually work fine, and the first one clicked will be correct. But if I subsequently click another in the row (2nd or 3rd), I get the contents of the modal with the first click. I am thinking this is a reference error or caching problem but can't see anything in the documentation that would help me resolve this. Refreshing the page and clicking the second item shows correctly, but now the first item will show the contents of the second (and vice-versa).

Can I force the action to always take a fresh instance, or can someone suggest ways I should debug this?

Code:
 public static function getActions(): array
    {
        return [
            Action::make('view_items')
                ->modalHeading(fn($record) => 'Item # ' . $record->id)
                ->modalSubmitAction(false)
                ->modalContent(function ($record) { return view('components.modals.view-item', [ 'record' => $record, '_nocache' => uniqid() ]); }),

            Action::make('view_summary')
                ->icon('heroicon-o-table-cells')
                ->url(function ($record) { return view('components.modals.summary', [ 'record' => $record, '_nocache' => uniqid() ])->render();
                }),

            Action::make('view_detail')
                ->modalHeading('Detailed Report')
                ->modalContent(function ($record) { return view('components.modals.report', [ 'record' => $record, '_nocache' => uniqid() // Add random parameter to prevent caching ]); }),
        ];
    }
 public static function getActions(): array
    {
        return [
            Action::make('view_items')
                ->modalHeading(fn($record) => 'Item # ' . $record->id)
                ->modalSubmitAction(false)
                ->modalContent(function ($record) { return view('components.modals.view-item', [ 'record' => $record, '_nocache' => uniqid() ]); }),

            Action::make('view_summary')
                ->icon('heroicon-o-table-cells')
                ->url(function ($record) { return view('components.modals.summary', [ 'record' => $record, '_nocache' => uniqid() ])->render();
                }),

            Action::make('view_detail')
                ->modalHeading('Detailed Report')
                ->modalContent(function ($record) { return view('components.modals.report', [ 'record' => $record, '_nocache' => uniqid() // Add random parameter to prevent caching ]); }),
        ];
    }
Filament banner
FilamentJoin
A powerful open source UI framework for Laravel • Build and ship admin panels & apps fast with Livewire
20,307Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Prevent Modal from closing on submit.
FilamentFFilament / ❓┊help
8mo ago
Prevent Modal from closing on a specific event
FilamentFFilament / ❓┊help
3y ago
Prevent action modal from closing automatically
FilamentFFilament / ❓┊help
3y ago
Table Caching
FilamentFFilament / ❓┊help
15mo ago