rappasoft / laravel-livewire-tables

A dynamic table component for Laravel Livewire
https://rappasoft.com/docs/laravel-livewire-tables/v2/introduction
MIT License
1.79k stars 339 forks source link

[Bug]: setDefaultPerPage don't work, fallback always to the first in setPerPageAccepted #2050

Open nickurt opened 4 days ago

nickurt commented 4 days ago

What happened?

I can't set the defaultPerPage anymore for my DataTables (nothing in my session), it always fallbacks to the first option of the setPerPageAccepted (for me, 10 instead of 25).

Looks like this part of code is affected - https://github.com/rappasoft/laravel-livewire-tables/blob/master/src/Traits/WithPagination.php#L58-L65

How to reproduce the bug

public function configure(): void
{
    $this->setPerPageAccepted([10, 25, 50, 100])->setDefaultPerPage(25);
}

When I'm using this, the page always shows me 10 results instead of the default 25, while I have nothing in my session for per/page value.

Package Version

3.5.0

PHP Version

8.3.x

Laravel Version

11.30.0

Alpine Version

3.14.3

Theme

Tailwind 3.x

Notes

No response

Error Message

No response

ahmadrivaldi-arv commented 3 days ago

Have you tried clearing the cache?

php artisan optimize:clear
nickurt commented 3 days ago

Yes, no effect at all

lrljoe commented 2 days ago

Thanks for raising, will takw a look this weekend