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