Skip to content

Commit

Permalink
fix: render loop when pagination count is 0
Browse files Browse the repository at this point in the history
  • Loading branch information
codeofmochi committed Jul 13, 2021
1 parent 4589a20 commit 64004ef
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/components/main/ItemsGrid.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const ItemsGrid = (props) => {
const pagesCount = Math.ceil(items.size / itemsPerPage);

// bugfix: since page state is independent from search, must ensure always within range
if (page > pagesCount) {
if (page !== 1 && page > pagesCount) {
setPage(1);
}

Expand Down

0 comments on commit 64004ef

Please sign in to comment.