From 0d4730d6f81016190c98dd60f967ceb296d2b044 Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Thu, 5 Dec 2019 15:40:29 +0200 Subject: [PATCH] eslint --fix fixes for missing dependencies for react hooks --- client/app/components/EditParameterSettingsDialog.jsx | 2 +- client/app/components/TimeAgo.jsx | 2 +- client/app/components/Timer.jsx | 2 +- .../app-header/components/FavoritesDropdown.jsx | 2 +- .../permissions-editor/PermissionsEditorDialog.jsx | 8 ++++---- client/app/pages/alert/components/MenuButton.jsx | 2 +- client/app/pages/alert/components/Rearm.jsx | 2 +- client/app/pages/home/Home.jsx | 2 +- client/app/visualizations/EditVisualizationDialog.jsx | 2 +- client/app/visualizations/VisualizationRenderer.jsx | 4 ++-- client/app/visualizations/chart/Editor/SeriesSettings.jsx | 2 +- .../visualizations/chart/Renderer/CustomPlotlyChart.jsx | 2 +- .../visualizations/choropleth/Editor/BoundsSettings.jsx | 2 +- client/app/visualizations/choropleth/Renderer/index.jsx | 2 +- client/app/visualizations/cohort/Cornelius.jsx | 2 +- client/app/visualizations/funnel/Renderer/index.jsx | 2 +- 16 files changed, 20 insertions(+), 20 deletions(-) diff --git a/client/app/components/EditParameterSettingsDialog.jsx b/client/app/components/EditParameterSettingsDialog.jsx index fbae2eb71d..b5af2fde63 100644 --- a/client/app/components/EditParameterSettingsDialog.jsx +++ b/client/app/components/EditParameterSettingsDialog.jsx @@ -92,7 +92,7 @@ function EditParameterSettingsDialog(props) { setInitialQuery(query); }); } - }, []); + }, [props.parameter]); function isFulfilled() { // name diff --git a/client/app/components/TimeAgo.jsx b/client/app/components/TimeAgo.jsx index fd4e08b2ca..c2e5b1cb48 100644 --- a/client/app/components/TimeAgo.jsx +++ b/client/app/components/TimeAgo.jsx @@ -26,7 +26,7 @@ export function TimeAgo({ date, placeholder, autoUpdate }) { const timer = setInterval(forceUpdate, 30 * 1000); return () => clearInterval(timer); } - }, [autoUpdate]); + }, [autoUpdate, forceUpdate]); return ( diff --git a/client/app/components/Timer.jsx b/client/app/components/Timer.jsx index ebaa976b74..bdca500715 100644 --- a/client/app/components/Timer.jsx +++ b/client/app/components/Timer.jsx @@ -12,7 +12,7 @@ export function Timer({ from }) { useEffect(() => { const timer = setInterval(forceUpdate, 1000); return () => clearInterval(timer); - }, []); + }, [forceUpdate]); const diff = moment.now() - startTime; const format = diff > 1000 * 60 * 60 ? 'HH:mm:ss' : 'mm:ss'; // no HH under an hour diff --git a/client/app/components/app-header/components/FavoritesDropdown.jsx b/client/app/components/app-header/components/FavoritesDropdown.jsx index d21642792c..3849e43ea3 100644 --- a/client/app/components/app-header/components/FavoritesDropdown.jsx +++ b/client/app/components/app-header/components/FavoritesDropdown.jsx @@ -27,7 +27,7 @@ export default function FavoritesDropdown({ fetch, urlTemplate }) { }, [fetch]); // fetch items on init - useEffect(() => fetchItems(false), []); + useEffect(() => fetchItems(false), [fetchItems]); // fetch items on click const onVisibleChange = visible => visible && fetchItems(); diff --git a/client/app/components/permissions-editor/PermissionsEditorDialog.jsx b/client/app/components/permissions-editor/PermissionsEditorDialog.jsx index caa2112f86..e9bf43ca0e 100644 --- a/client/app/components/permissions-editor/PermissionsEditorDialog.jsx +++ b/client/app/components/permissions-editor/PermissionsEditorDialog.jsx @@ -77,7 +77,7 @@ function UserSelect({ onSelect, shouldShowUser }) { useEffect(() => { setLoadingUsers(true); debouncedSearchUsers(searchTerm); - }, [searchTerm]); + }, [debouncedSearchUsers, searchTerm]); return (