error fixes

This commit is contained in:
Alex Holliday committed 2025-12-23 19:54:00 +00:00
1 parent 4667c59573
commit 658c7c090f
3 files changed
+14 -7

No files matched your search

@@ -346,7 +346,6 @@ function HasMoreTablePaginationActions(
) { ) {
const theme = useTheme(); const theme = useTheme();
const { hasMore, page, onPageChange } = props; const { hasMore, page, onPageChange } = props;
console.log(JSON.stringify(props, null, 2));
const handleFirstPageButtonClick = ( const handleFirstPageButtonClick = (
event: React.MouseEvent<HTMLButtonElement> event: React.MouseEvent<HTMLButtonElement>
@@ -420,7 +419,7 @@ interface PaginationProps extends TablePaginationProps {
} }
export const Pagination = ({ ...props }: PaginationProps) => { export const Pagination = ({ ...props }: PaginationProps) => {
const hasMore = props.hasMore; const { hasMore, ...rest } = props;
const isSmall = useMediaQuery((theme: any) => theme.breakpoints.down("sm")); const isSmall = useMediaQuery((theme: any) => theme.breakpoints.down("sm"));
const theme = useTheme(); const theme = useTheme();
const labelDisplayedRows = ({ const labelDisplayedRows = ({
@@ -440,12 +439,16 @@ export const Pagination = ({ ...props }: PaginationProps) => {
return ( return (
<TablePagination <TablePagination
ActionsComponent={ ActionsComponent={(props) =>
hasMore ? HasMoreTablePaginationActions : TablePaginationActions typeof hasMore === "boolean" ? (
<HasMoreTablePaginationActions {...props} hasMore={hasMore} />
) : (
<TablePaginationActions {...props} />
)
} }
rowsPerPageOptions={[5, 10, 25]} rowsPerPageOptions={[5, 10, 25]}
labelDisplayedRows={labelDisplayedRows} labelDisplayedRows={labelDisplayedRows}
{...props} {...rest}
sx={{ sx={{
"& .MuiTablePagination-toolbar": isSmall "& .MuiTablePagination-toolbar": isSmall
? { ? {
+5 -1
View File
@@ -7,7 +7,7 @@ import { ChecksTable } from "@/pages/checks/ChecksTable";
import { LoadingSpinner } from "@/components/design-elements"; import { LoadingSpinner } from "@/components/design-elements";
import { useTheme } from "@mui/material/styles"; import { useTheme } from "@mui/material/styles";
import { useState } from "react"; import { useEffect, useState } from "react";
import type { SelectChangeEvent } from "@mui/material/Select"; import type { SelectChangeEvent } from "@mui/material/Select";
import { useGet } from "@/hooks/UseApi"; import { useGet } from "@/hooks/UseApi";
import type { ApiResponse } from "@/types/api"; import type { ApiResponse } from "@/types/api";
@@ -46,6 +46,10 @@ const ChecksPage = () => {
const checks = checksResponse?.data?.checks || []; const checks = checksResponse?.data?.checks || [];
const hasMore = checksResponse?.data?.hasMore; const hasMore = checksResponse?.data?.hasMore;
useEffect(() => {
setPage(0);
}, [range, status, selectedMonitorId]);
return ( return (
<BasePage> <BasePage>
<InfoBox <InfoBox
+1 -1
View File
@@ -114,7 +114,7 @@ export const ChecksTable = ({
/> />
<Pagination <Pagination
component="div" component="div"
count={0} count={(page + 1) * rowsPerPage + 1}
hasMore={hasMore} hasMore={hasMore}
page={page} page={page}
rowsPerPage={rowsPerPage} rowsPerPage={rowsPerPage}