From d7372bfb13e8083444eaa4f34e9a6c4ba4970efd Mon Sep 17 00:00:00 2001 From: ntsekouras Date: Mon, 16 Oct 2023 18:42:21 +0300 Subject: [PATCH] [Data views]: Fix pagination --- .../src/components/dataviews/pagination.js | 29 +++++++++++-------- .../src/components/dataviews/text-filter.js | 1 + .../src/components/dataviews/view-actions.js | 2 +- .../src/components/page-pages/index.js | 4 +-- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/packages/edit-site/src/components/dataviews/pagination.js b/packages/edit-site/src/components/dataviews/pagination.js index bd6cb503653b0..2f52d8da637e8 100644 --- a/packages/edit-site/src/components/dataviews/pagination.js +++ b/packages/edit-site/src/components/dataviews/pagination.js @@ -36,7 +36,7 @@ function PageSizeControl( { view, onChangeView } ) { label: pageSize, } ) ) } onChange={ ( value ) => - onChangeView( { ...view, perPage: value } ) + onChangeView( { ...view, perPage: value, page: 1 } ) } /> ); @@ -50,7 +50,6 @@ function Pagination( { onChangeView, paginationInfo: { totalItems = 0, totalPages }, } ) { - const currentPage = view.page + 1; if ( ! totalItems || ! totalPages ) { return null; } @@ -75,8 +74,8 @@ function Pagination( {