From 67015167f4588d644fa980c1e9c291f4d8cb781b Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Thu, 5 Dec 2019 15:28:14 +0200 Subject: [PATCH 01/13] Remove app/service/query-string (unused) and its dependency. --- client/app/services/query-string.js | 11 ----------- package.json | 1 - 2 files changed, 12 deletions(-) delete mode 100644 client/app/services/query-string.js diff --git a/client/app/services/query-string.js b/client/app/services/query-string.js deleted file mode 100644 index 4f67c0494c..0000000000 --- a/client/app/services/query-string.js +++ /dev/null @@ -1,11 +0,0 @@ -import qs from 'qs'; - -const parse = queryString => qs.parse(queryString, { allowDots: true, ignoreQueryPrefix: true }); -const onlyParameters = ([k]) => k.startsWith('p_'); -const removePrefix = ([k, v]) => [k.slice(2), v]; -const toObject = (obj, [k, v]) => Object.assign(obj, { [k]: v }); - -export default () => Object.entries(parse(location.search)) - .filter(onlyParameters) - .map(removePrefix) - .reduce(toObject, {}); diff --git a/package.json b/package.json index f1dcc79eea..cc9796e57c 100644 --- a/package.json +++ b/package.json @@ -71,7 +71,6 @@ "pace-progress": "git+https://github.com/getredash/pace.git", "plotly.js": "1.41.3", "prop-types": "^15.6.1", - "qs": "^6.7.0", "react": "^16.8.3", "react-ace": "^6.1.0", "react-dom": "^16.8.3", From cf6d7807e9a716cdc80badb48cfe42a5d082399d Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Thu, 5 Dec 2019 15:28:44 +0200 Subject: [PATCH 02/13] Fix usage of mixed operators. --- client/app/visualizations/chart/plotly/prepareHeatmapData.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/app/visualizations/chart/plotly/prepareHeatmapData.js b/client/app/visualizations/chart/plotly/prepareHeatmapData.js index 0f3448c669..2ab84bb2a3 100644 --- a/client/app/visualizations/chart/plotly/prepareHeatmapData.js +++ b/client/app/visualizations/chart/plotly/prepareHeatmapData.js @@ -66,7 +66,7 @@ function prepareSeries(series, options, additionalOptions) { { x: plotlySeries.x[j], y: plotlySeries.y[i] }, ); - const zValue = datum && datum.zVal || 0; + const zValue = (datum && datum.zVal) || 0; item.push(zValue); if (isFinite(zMax) && options.showDataLabels) { From 0d4730d6f81016190c98dd60f967ceb296d2b044 Mon Sep 17 00:00:00 2001 From: Arik Fraimovich Date: Thu, 5 Dec 2019 15:40:29 +0200 Subject: [PATCH 03/13] 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 (