Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
majkshkurti committed Oct 22, 2024
1 parent 50b5195 commit 13df110
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
11 changes: 10 additions & 1 deletion apps/web/app/[lng]/(dashboard)/datasets/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {
Typography,
} from "@mui/material";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { useEffect, useState } from "react";

import { ICON_NAME, Icon } from "@p4b/ui/components/Icon";

Expand Down Expand Up @@ -93,6 +93,15 @@ const Datasets = () => {
},
];

useEffect(() => {
if (datasets?.pages && queryParams?.page && datasets?.pages < queryParams?.page) {
setQueryParams({
...queryParams,
page: datasets.pages,
});
}
}, [datasets, queryParams]);

return (
<Container sx={{ py: 10, px: 10 }} maxWidth="xl">
{addDatasetModal === AddLayerSourceType.DatasourceUpload && (
Expand Down
11 changes: 10 additions & 1 deletion apps/web/app/[lng]/(dashboard)/projects/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { Box, Button, Container, Grid, Pagination, Paper, Stack, Typography } from "@mui/material";
import { useRouter } from "next/navigation";
import { useState } from "react";
import { useEffect, useState } from "react";

import { ICON_NAME, Icon } from "@p4b/ui/components/Icon";

Expand Down Expand Up @@ -34,6 +34,15 @@ const Projects = () => {
const [openProjectModal, setOpenProjectModal] = useState(false);
const { isOrgEditor } = useAuthZ();

useEffect(() => {
if (projects?.pages && queryParams?.page && projects?.pages < queryParams?.page) {
setQueryParams({
...queryParams,
page: projects.pages,
});
}
}, [projects, queryParams]);

return (
<Container sx={{ py: 10, px: 10 }} maxWidth="xl">
<ProjectModal type="create" open={openProjectModal} onClose={() => setOpenProjectModal(false)} />
Expand Down

0 comments on commit 13df110

Please sign in to comment.