Action buttons disappear when using ->cache() on PowerGrid table #1994
Closed
bennahiaoualid
started this conversation in
BUG
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Livewire PowerGrid version
v6.3.2
Livewire version
v3.6.4
Laravel version
v12.14.1
Which PHP version are you using?
PHP 8.4
Which Theme are you using?
Tailwind
Have you published the resource files and customized them? (php artisan vendor:publish)
Yes
What is the problem?
When enabling the built-in cache() feature in a Livewire PowerGrid component, all row action buttons disappear from the rendered table.
Without cache(), the same component renders and works correctly.
Code snippets
showSearchInput(), PowerGrid::footer() ->showPerPage() ->showRecordCount(), PowerGrid::cache() ->customTag('competitions'), ]; } public function datasource(): Builder { return Competition::query()->with("admin"); } public function relationSearch(): array { return []; } public function fields(): PowerGridFields { return PowerGrid::fields() ->add('title') ->add('created_by', function ($competition) { if($competition->admin){ return sprintf( '%s', route("admin.edit",["id" => e($competition->admin->id)]), e($competition->admin->name) ); } }) ->add('start_date_local', function ($competition) { return DateTimeHelper::toLocalDateTime($competition->start_date); }) ->add('users_age', function ($competition) { return e( __("competition.info.from") ." ". $competition->age_start . " " . __("competition.info.to") ." ". $competition->age_end ); }) ->add('status', function ($competition) { return Blade::render( '' ); }); } public function columns(): array { return [ Column::make(__('competition.info.title'), 'title') ->sortable() ->searchable(), Column::make(__('competition.info.created_by'), 'created_by'), Column::make(__('competition.info.start_date'), 'start_date_local','start_date') ->sortable(), Column::make(__('competition.info.users_age'), 'users_age'), Column::make(__('competition.info.status.state'), 'status'), Column::action('Action') ]; } public function filters(): array { return [ Filter::inputText('title', 'title') ->operators(['starts_with']), ]; } public function actions(Competition $row): array { return [ Button::add('edit') ->slot('') ->class('inline-flex items-center border rounded-md font-semibold uppercase cursor-pointer tracking-widest focus:outline-none focus:ring-2 focus:ring-offset-2 transition ease-in-out duration-150 px-2 py-1 text-lg bg-transparent text-info border-info hover:bg-info hover:text-white focus:bg-info focus:text-white active:bg-info active:text-white focus:ring-info') ->route('admin.competitions.edit', ['id' =>base64_encode( $row->id)]), Button::add('delete_competitions') ->slot(' ') ->class('px-2 py-1 inline-flex items-center border rounded-md font-semibold uppercase cursor-pointer tracking-widest focus:outline-none focus:ring-2 focus:ring-offset-2 transition ease-in-out duration-150 bg-transparent text-danger border-danger hover:bg-danger hover:text-white focus:bg-danger focus:text-white active:bg-danger active:text-white focus:ring-danger') ->can($row->canEdit()) ->dispatch('open-modal', ['detail' => 'delete', 'value' => $row->id]), ]; } public function template(): ?string { return TailwindStriped::class; } } ### How do you expect it to work? its should alwasy rendering the action buttons with or without cache ### Please confirm (incomplete submissions will not be addressed) - [X] I have provided easy and step-by-step instructions to reproduce the bug. - [X] I have provided code samples as text and NOT images. - [X] I understand my bug report will be removed if I haven't met the criteria above.Beta Was this translation helpful? Give feedback.
All reactions