|
@@ -1,4 +1,4 @@
|
|
-import React from 'react';
|
|
|
|
|
|
+import React, { useCallback } from 'react';
|
|
import { Routes, Route, useLocation } from 'react-router-dom';
|
|
import { Routes, Route, useLocation } from 'react-router-dom';
|
|
import { GIT_TAG, GIT_COMMIT } from 'lib/constants';
|
|
import { GIT_TAG, GIT_COMMIT } from 'lib/constants';
|
|
import { clusterPath, getNonExactPath } from 'lib/paths';
|
|
import { clusterPath, getNonExactPath } from 'lib/paths';
|
|
@@ -25,15 +25,13 @@ const App: React.FC = () => {
|
|
const areClustersFulfilled = useAppSelector(getAreClustersFulfilled);
|
|
const areClustersFulfilled = useAppSelector(getAreClustersFulfilled);
|
|
const clusters = useAppSelector(getClusterList);
|
|
const clusters = useAppSelector(getClusterList);
|
|
const [isSidebarVisible, setIsSidebarVisible] = React.useState(false);
|
|
const [isSidebarVisible, setIsSidebarVisible] = React.useState(false);
|
|
-
|
|
|
|
const onBurgerClick = () => setIsSidebarVisible(!isSidebarVisible);
|
|
const onBurgerClick = () => setIsSidebarVisible(!isSidebarVisible);
|
|
- const closeSidebar = () => setIsSidebarVisible(false);
|
|
|
|
-
|
|
|
|
|
|
+ const closeSidebar = useCallback(() => setIsSidebarVisible(false), []);
|
|
const location = useLocation();
|
|
const location = useLocation();
|
|
|
|
|
|
React.useEffect(() => {
|
|
React.useEffect(() => {
|
|
closeSidebar();
|
|
closeSidebar();
|
|
- }, [closeSidebar, location]);
|
|
|
|
|
|
+ }, [location, closeSidebar]);
|
|
|
|
|
|
React.useEffect(() => {
|
|
React.useEffect(() => {
|
|
dispatch(fetchClusters());
|
|
dispatch(fetchClusters());
|