Fix: Re-render of unrelated UI Components

This commit is contained in:
Br0wnHammer committed 2025-05-06 00:41:40 +05:30
1 parent 7bb1245e52
commit 673022120f
2 files changed
+6 -6

No files matched your search

@@ -1,14 +1,13 @@
import { Stack, Button } from "@mui/material";
import { useNavigate } from "react-router-dom";
import PropTypes from "prop-types";
import SkeletonLayout from "./skeleton";
import { useTranslation } from "react-i18next";
import { useTheme } from "@emotion/react";
const CreateMonitorHeader = ({
isAdmin,
label = "Create new",
shouldRender = true,
isLoading = true,
path,
bulkPath,
}) => {
@@ -17,7 +16,6 @@ const CreateMonitorHeader = ({
const theme = useTheme();
if (!isAdmin) return null;
if (!shouldRender) return <SkeletonLayout />;
return (
<Stack
@@ -27,6 +25,7 @@ const CreateMonitorHeader = ({
gap={theme.spacing(6)}
>
<Button
loading={isLoading}
variant="contained"
color="accent"
onClick={() => navigate(path)}
@@ -35,6 +34,7 @@ const CreateMonitorHeader = ({
</Button>
{bulkPath && (
<Button
loading={isLoading}
variant="contained"
color="accent"
onClick={() => {
@@ -52,7 +52,7 @@ export default CreateMonitorHeader;
CreateMonitorHeader.propTypes = {
isAdmin: PropTypes.bool.isRequired,
shouldRender: PropTypes.bool,
isLoading: PropTypes.bool,
path: PropTypes.string.isRequired,
label: PropTypes.string,
bulkPath: PropTypes.string,