remove utility hook
This commit is contained in:
1 parent
89d0a74ade
commit
1898880774
1 file changed
-40
@@ -24,32 +24,6 @@ import useDebounce from "../../../Utils/debounce";
|
|||||||
|
|
||||||
const BREADCRUMBS = [{ name: `Uptime`, path: "/uptime" }];
|
const BREADCRUMBS = [{ name: `Uptime`, path: "/uptime" }];
|
||||||
|
|
||||||
const useWhyDidYouUpdate = (name, props) => {
|
|
||||||
const previousProps = useRef();
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (previousProps.current) {
|
|
||||||
const allKeys = Object.keys({ ...previousProps.current, ...props });
|
|
||||||
const changesObj = {};
|
|
||||||
|
|
||||||
allKeys.forEach((key) => {
|
|
||||||
if (previousProps.current[key] !== props[key]) {
|
|
||||||
changesObj[key] = {
|
|
||||||
from: previousProps.current[key],
|
|
||||||
to: props[key],
|
|
||||||
};
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (Object.keys(changesObj).length) {
|
|
||||||
console.log("[why-did-you-update]", name, changesObj);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
previousProps.current = props;
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
const UptimeMonitors = () => {
|
const UptimeMonitors = () => {
|
||||||
// Redux state
|
// Redux state
|
||||||
const { isLoading, monitorsSummary } = useSelector((state) => state.uptimeMonitors);
|
const { isLoading, monitorsSummary } = useSelector((state) => state.uptimeMonitors);
|
||||||
@@ -83,20 +57,6 @@ const UptimeMonitors = () => {
|
|||||||
[authState.authToken, authState.user.teamId, sort, debouncedFilter, page, rowsPerPage]
|
[authState.authToken, authState.user.teamId, sort, debouncedFilter, page, rowsPerPage]
|
||||||
);
|
);
|
||||||
|
|
||||||
useWhyDidYouUpdate("UptimeMonitors", {
|
|
||||||
isLoading,
|
|
||||||
monitorsSummary,
|
|
||||||
authState,
|
|
||||||
rowsPerPage,
|
|
||||||
monitors,
|
|
||||||
sort,
|
|
||||||
search,
|
|
||||||
page,
|
|
||||||
isSearching,
|
|
||||||
monitorUpdateTrigger,
|
|
||||||
fetchParams,
|
|
||||||
});
|
|
||||||
|
|
||||||
const getMonitorWithPercentage = useCallback((monitor, theme) => {
|
const getMonitorWithPercentage = useCallback((monitor, theme) => {
|
||||||
let uptimePercentage = "";
|
let uptimePercentage = "";
|
||||||
let percentageColor = theme.palette.percentage.uptimeExcellent;
|
let percentageColor = theme.palette.percentage.uptimeExcellent;
|
||||||
|
|||||||
Reference in new issue
Block a user