fix state initialization, add proptype

This commit is contained in:
Alex Holliday
2024-09-19 14:15:16 +08:00
parent 59adc526fe
commit 21385864fc
2 changed files with 3 additions and 2 deletions

View File

@@ -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);

View File

@@ -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);