mirror of
https://github.com/rowboatlabs/rowboat.git
synced 2026-06-06 19:35:44 +02:00
Remove redundant state for pagination
This commit is contained in:
parent
3bb09f8593
commit
906538d5be
1 changed files with 1 additions and 7 deletions
|
|
@ -87,8 +87,8 @@ export default function SimulationApp() {
|
|||
const [allRunResults, setAllRunResults] = useState<Record<string, SimulationResultType[]>>({});
|
||||
const [workflowVersions, setWorkflowVersions] = useState<Record<string, WithStringId<z.infer<typeof Workflow>>>>({});
|
||||
const [menuOpenId, setMenuOpenIdState] = useState<string | null>(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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue