Skip to content

Commit

Permalink
Merge pull request #235 from ocolefed/svelte-pagination-reactive
Browse files Browse the repository at this point in the history
Fix pagination component reactivity
  • Loading branch information
roblevintennis committed Jun 6, 2022
2 parents d4a8f97 + f8c6040 commit b577e80
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -124,13 +124,18 @@
next: "Next",
};
function genPages(page) {
function genPages(page, total) {
if (pageGenerator) {
pages = pageGenerator.generate(page, total);
}
// If the number of pages is decreased, ensure that we're still pointing to a valid page
if(current > total){
current = total;
console.warn("Pagination current page exceeds total number of pages");
}
}
$: genPages(current);
$: genPages(current, total);
// Note that in the template we've bound via bind:this -- essentially this is
Expand Down

0 comments on commit b577e80

Please sign in to comment.