Skip to content

Commit 34ffc95

Browse files
authored
Add pagination reset for perPage updates
If you have a small amount of records shown, the number of pages will be bigger than when you change the perPage to a larger amount of records. For instance, if you have 50 records total with a perPage of 10 and you are on page 5, when you change the perPage to 25, there won't be any results shown. With this change, the 1st page will be shown instead of incorrectly showing the no results message.
1 parent 6d3c5d7 commit 34ffc95

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/Traits/Pagination.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,13 @@ public function updatingSearch(): void
5555
{
5656
$this->resetPage();
5757
}
58+
59+
/**
60+
* https://laravel-livewire.com/docs/pagination
61+
* Resetting Pagination After Changing the perPage.
62+
*/
63+
public function updatingPerPage(): void
64+
{
65+
$this->resetPage();
66+
}
5867
}

0 commit comments

Comments
 (0)