From 906538d5be736cbb4d70c2e2474523d2fce5138d Mon Sep 17 00:00:00 2001 From: akhisud3195 Date: Thu, 20 Feb 2025 13:29:17 +0530 Subject: [PATCH] Remove redundant state for pagination --- apps/rowboat/app/projects/[projectId]/simulation/app.tsx | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/apps/rowboat/app/projects/[projectId]/simulation/app.tsx b/apps/rowboat/app/projects/[projectId]/simulation/app.tsx index 0e33993a..c2564b76 100644 --- a/apps/rowboat/app/projects/[projectId]/simulation/app.tsx +++ b/apps/rowboat/app/projects/[projectId]/simulation/app.tsx @@ -87,8 +87,8 @@ export default function SimulationApp() { const [allRunResults, setAllRunResults] = useState>({}); const [workflowVersions, setWorkflowVersions] = useState>>>({}); const [menuOpenId, setMenuOpenIdState] = useState(null); - const [currentPage, setCurrentPage] = useState(Number(searchParams.get('page')) || 1); const runsPerPage = 10; + const currentPage = Number(searchParams.get('page')) || 1; const setMenuOpenId = useCallback((id: string | null) => { setMenuOpenIdState(id); @@ -375,12 +375,6 @@ export default function SimulationApp() { } }; - // Add this effect to update currentPage when URL changes - useEffect(() => { - const page = Number(searchParams.get('page')) || 1; - setCurrentPage(page); - }, [searchParams]); - const indexOfLastRun = currentPage * runsPerPage; const indexOfFirstRun = indexOfLastRun - runsPerPage; const currentRuns = runs.slice(indexOfFirstRun, indexOfLastRun);