Skip to content

Commit

Permalink
improved paging (#1072)
Browse files Browse the repository at this point in the history
  • Loading branch information
grzanka authored Jun 13, 2023
1 parent 08ca846 commit 3adbbef
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/WrapperApp/components/Simulation/SimulationPanel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ export default function SimulationPanel({
const [showInputFilesEditor, setShowInputFilesEditor] = useState(false);
const [showRunSimulationsForm, setShowRunSimulationsForm] = useState(!!forwardedInputFiles);

const [pageIdx, setPageIdx] = useState(0);
const [pageCount, setPageCount] = useState(0);
const [pageIdx, setPageIdx] = useState(1);
const [pageCount, setPageCount] = useState(1);
const [orderType, setOrderType] = useState<OrderType>(OrderType.ASCEND);
const [orderBy, setOrderBy] = useState<OrderBy>(OrderBy.START_TIME);
const [pageSize, setPageSize] = useState(6);
Expand All @@ -90,7 +90,7 @@ export default function SimulationPanel({

const updateSimulationInfo = useCallback(
() =>
getPageContents(pageIdx - 1, pageSize, orderType, orderBy)
getPageContents(pageIdx, pageSize, orderType, orderBy)
.then(results => {
const { simulations, pageCount } = results;
setSimulationInfo([...simulations]);
Expand All @@ -115,7 +115,7 @@ export default function SimulationPanel({
!DEMO_MODE &&
getPageStatus(simulationInfo, true, handleBeforeCacheWrite, controller.signal).then(
s => {
setSimulationsStatusData([...s.reverse()]);
setSimulationsStatusData([...s]);
}
),
[handleBeforeCacheWrite, controller.signal, getPageStatus, simulationInfo]
Expand Down Expand Up @@ -275,7 +275,7 @@ export default function SimulationPanel({
newOrderBy: OrderBy = orderBy
) =>
getPageContents(
newPageIdx - 1,
newPageIdx,
newPageSize,
newOrderType,
newOrderBy,
Expand Down

0 comments on commit 3adbbef

Please sign in to comment.