From ce14399777bc3b9c983d646e152cd8a0882b0eb5 Mon Sep 17 00:00:00 2001 From: Lilian Delouvy <58565718+lilian-delouvy@users.noreply.github.com> Date: Fri, 7 Jan 2022 17:12:13 +0100 Subject: [PATCH] fix(Dataset): paging bug on dataset files visualization removed (#151) --- .../ClientApp/src/Server/Dataset/Edit/FileList.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Ml.Cli.WebApp/ClientApp/src/Server/Dataset/Edit/FileList.js b/src/Ml.Cli.WebApp/ClientApp/src/Server/Dataset/Edit/FileList.js index 07a5db15c..1946fd6c6 100644 --- a/src/Ml.Cli.WebApp/ClientApp/src/Server/Dataset/Edit/FileList.js +++ b/src/Ml.Cli.WebApp/ClientApp/src/Server/Dataset/Edit/FileList.js @@ -26,14 +26,15 @@ const FileList = ({state, setState}) => { }; const onChangePaging = ({numberItems, page}) => { - console.log(numberItems, page) + const newNumberPages = computeNumberPages(state.filesSend, numberItems); + const newCurrentPage = state.paging.currentPages > newNumberPages ? newNumberPages : page setState({...state, paging: { itemByPages: numberItems, - currentPages: page, - itemFiltered: filterPaging(state.filesSend, numberItems, page), - numberPages: computeNumberPages(state.filesSend, numberItems)} - }) + currentPages: newCurrentPage, + itemFiltered: filterPaging(state.filesSend, numberItems, newCurrentPage), + numberPages: newNumberPages + }}); }; return (