From 21385864fc722fa4e66f8f606253eb5eda5c2def Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Thu, 19 Sep 2024 14:15:16 +0800 Subject: [PATCH] fix state initialization, add proptype --- Client/src/Pages/Monitors/Home/MonitorTable/index.jsx | 3 ++- Client/src/Pages/Monitors/Home/index.jsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Client/src/Pages/Monitors/Home/MonitorTable/index.jsx b/Client/src/Pages/Monitors/Home/MonitorTable/index.jsx index ff8297848..8533ddacc 100644 --- a/Client/src/Pages/Monitors/Home/MonitorTable/index.jsx +++ b/Client/src/Pages/Monitors/Home/MonitorTable/index.jsx @@ -167,7 +167,7 @@ const MonitorTable = ({ isAdmin, filter, setLoading }) => { } }; fetchPage(); - }, [updateTrigger, authState, page, rowsPerPage, filter, sort]); + }, [updateTrigger, authState, page, rowsPerPage, filter, sort, setLoading]); /** * Helper function to calculate the range of displayed rows. @@ -408,6 +408,7 @@ const MonitorTable = ({ isAdmin, filter, setLoading }) => { MonitorTable.propTypes = { isAdmin: PropTypes.bool, filter: PropTypes.string, + setLoading: PropTypes.func, }; const MemoizedMonitorTable = memo(MonitorTable); diff --git a/Client/src/Pages/Monitors/Home/index.jsx b/Client/src/Pages/Monitors/Home/index.jsx index af439650b..c2a532bb9 100644 --- a/Client/src/Pages/Monitors/Home/index.jsx +++ b/Client/src/Pages/Monitors/Home/index.jsx @@ -27,7 +27,7 @@ const Monitors = ({ isAdmin }) => { const monitorState = useSelector((state) => state.uptimeMonitors); const authState = useSelector((state) => state.auth); const [search, setSearch] = useState(""); - const [isSearching, setIsSearching] = useState(""); + const [isSearching, setIsSearching] = useState(false); const dispatch = useDispatch({}); const debouncedFilter = useDebounce(search, 500);