Passing as a child of breaks search wehn MonitorCountHeader rerenders

This commit is contained in:
Alex Holliday committed 2025-01-28 15:37:01 -08:00
1 parent ff17092e8a
commit b410c14d93
1 file changed
+11 -9
@@ -1,6 +1,5 @@
// Components // Components
import { Box, Stack, CircularProgress } from "@mui/material"; import { Box, Stack } from "@mui/material";
import { Heading } from "../../../../../Components/Heading";
import DataTable from "../../../../../Components/Table"; import DataTable from "../../../../../Components/Table";
import ArrowDownwardRoundedIcon from "@mui/icons-material/ArrowDownwardRounded"; import ArrowDownwardRoundedIcon from "@mui/icons-material/ArrowDownwardRounded";
import ArrowUpwardRoundedIcon from "@mui/icons-material/ArrowUpwardRounded"; import ArrowUpwardRoundedIcon from "@mui/icons-material/ArrowUpwardRounded";
@@ -12,8 +11,8 @@ import { useState } from "react";
import SearchComponent from "../SearchComponent"; import SearchComponent from "../SearchComponent";
import CircularCount from "../../../../../Components/CircularCount"; import CircularCount from "../../../../../Components/CircularCount";
import LoadingSpinner from "../LoadingSpinner"; import LoadingSpinner from "../LoadingSpinner";
import MonitorCountHeader from "../../../../../Components/MonitorCountHeader";
import UptimeDataTableSkeleton from "./skeleton"; import UptimeDataTableSkeleton from "./skeleton";
import { Heading } from "../../../../../Components/Heading";
// Utils // Utils
import { useTheme } from "@emotion/react"; import { useTheme } from "@emotion/react";
@@ -216,19 +215,21 @@ const UptimeDataTable = (props) => {
flex={1} flex={1}
py={theme.spacing(8)} py={theme.spacing(8)}
> >
<MonitorCountHeader <Stack
shouldRender={!monitorsAreLoading} direction="row"
monitorCount={monitorCount} alignItems="center"
heading="Uptime monitors" mb={theme.spacing(8)}
sx={{ mb: theme.spacing(8) }} gap={theme.spacing(2)}
> >
<Heading component="h2">Uptime monitors</Heading>
<CircularCount count={monitorCount} />
<SearchComponent <SearchComponent
monitorsAreLoading={monitorsAreLoading} monitorsAreLoading={monitorsAreLoading}
monitors={monitors} monitors={monitors}
onSearchChange={setSearch} onSearchChange={setSearch}
setIsSearching={setIsSearching} setIsSearching={setIsSearching}
/> />
</MonitorCountHeader> </Stack>
<MonitorDataTable <MonitorDataTable
shouldRender={!monitorsAreLoading} shouldRender={!monitorsAreLoading}
@@ -255,6 +256,7 @@ UptimeDataTable.propTypes = {
monitors: PropTypes.array, monitors: PropTypes.array,
filteredMonitors: PropTypes.array, filteredMonitors: PropTypes.array,
monitorCount: PropTypes.number, monitorCount: PropTypes.number,
monitorsAreLoading: PropTypes.bool,
sort: PropTypes.shape({ sort: PropTypes.shape({
field: PropTypes.string, field: PropTypes.string,
order: PropTypes.oneOf(["asc", "desc"]), order: PropTypes.oneOf(["asc", "desc"]),