From 86a0a01f3f0b451372b1ea8e1ea96337078bfc57 Mon Sep 17 00:00:00 2001 From: Carles Pastor Date: Sun, 12 Mar 2023 19:28:16 +0100 Subject: [PATCH 1/2] Reset page prop when resetPageOnUpdate is enabled otherwise the current page will be set to 0 but the prop will still retain its old value, causing issues with server side pagination. --- src/view/plugin/pagination.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/view/plugin/pagination.tsx b/src/view/plugin/pagination.tsx index d8feb1b5..2076d27d 100644 --- a/src/view/plugin/pagination.tsx +++ b/src/view/plugin/pagination.tsx @@ -85,6 +85,10 @@ export function Pagination() { // when a processor is updated for some reason if (resetPageOnUpdate && updatedProcessor !== processor.current) { setCurrentPage(0); + + processor.current.setProps({ + page: 0, + }); } }; From 646e7a3faaac7d8de0058f11af644ed4752541c3 Mon Sep 17 00:00:00 2001 From: Carles Pastor Date: Sat, 25 Mar 2023 21:25:19 +0100 Subject: [PATCH 2/2] Only set page prop back to 0 if it isn't already this way we prevent duplicated api calls. --- src/view/plugin/pagination.tsx | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/view/plugin/pagination.tsx b/src/view/plugin/pagination.tsx index 2076d27d..f9d7c464 100644 --- a/src/view/plugin/pagination.tsx +++ b/src/view/plugin/pagination.tsx @@ -86,9 +86,11 @@ export function Pagination() { if (resetPageOnUpdate && updatedProcessor !== processor.current) { setCurrentPage(0); - processor.current.setProps({ - page: 0, - }); + if (processor.current.props.page !== 0) { + processor.current.setProps({ + page: 0, + }); + } } };