From bc137a2ed7e103cab9ac0d8cdd2a8957bd3f5850 Mon Sep 17 00:00:00 2001 From: Frank Hereford Date: Sun, 21 Nov 2021 10:51:58 -0600 Subject: [PATCH 1/7] Push logic of when to render map out of error handler --- .../ProjectSummary/ProjectSummary.js | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummary.js b/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummary.js index d916ded4fd..1c3fbff7c4 100644 --- a/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummary.js +++ b/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummary.js @@ -24,6 +24,8 @@ import ProjectSummaryProjectDescription from "./ProjectSummaryProjectDescription import ProjectSummaryCurrentStatus from "./ProjectSummaryCurrentStatus"; import ProjectSummaryProjectECapris from "./ProjectSummaryProjectECapris"; +import { countFeatures } from "../../../../utils/mapHelpers" + const useStyles = makeStyles(theme => ({ fieldGridItem: { margin: theme.spacing(2), @@ -103,9 +105,21 @@ const ProjectSummary = ({ loading, error, data, refetch }) => { projectFeatureRecords ); - if (projectFeatureRecords.length === 0 && !makeSureRefresh) + if (projectFeatureRecords.length === 0 && !makeSureRefresh) setMakeSureRefresh(true); + const renderMap = () => { + if (countFeatures(projectFeatureCollection) < 1) { + return + } else { + return + } + } + return ( { onReset={() => setMapError(false)} resetKeys={[mapError]} > - + {renderMap()} )} From 42ebbe4bac62016e25762401ff1cc27b6bef12f7 Mon Sep 17 00:00:00 2001 From: Frank Hereford Date: Sun, 21 Nov 2021 10:52:17 -0600 Subject: [PATCH 2/7] Reenable error overlay --- .../projectView/ProjectSummary/ProjectSummaryMap.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMap.js b/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMap.js index 7642ad6ed8..acfa903a69 100644 --- a/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMap.js +++ b/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMap.js @@ -3,7 +3,7 @@ import ReactMapGL, { NavigationControl } from "react-map-gl"; import { Box, makeStyles } from "@material-ui/core"; import "mapbox-gl/dist/mapbox-gl.css"; import "react-map-gl-geocoder/dist/mapbox-gl-geocoder.css"; -import { stopReportingRuntimeErrors } from "react-error-overlay"; +//import { stopReportingRuntimeErrors } from "react-error-overlay"; import { createSummaryMapLayers, @@ -60,7 +60,15 @@ const ProjectSummaryMap = ({ projectExtentGeoJSON }) => { * Let's throw an error intentionally if there are no features for a project. */ if (featureCount < 1) { - stopReportingRuntimeErrors(); + // Does this have implications for the rest of the app, or is this directive contained + // in this branch of the component hierarchy? + // stopReportingRuntimeErrors(); + + // Invoking this component without any features to render should produce an error. + // However, we should not rely on the Error handling to do the test to see if we + // want to render the map, which should be handled up a level in the component tree. + // This is for when we render this component in error, not in the normal course + // of the application. throw Error("Map error: Cannot render or edit maps with no features"); } From a191f7bbb6ddd3642488fb917a37ac3f947a8520 Mon Sep 17 00:00:00 2001 From: Frank Hereford Date: Sun, 21 Nov 2021 19:07:21 -0600 Subject: [PATCH 3/7] Revise comment about errors --- .../projectView/ProjectSummary/ProjectSummaryMap.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMap.js b/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMap.js index acfa903a69..2479db0f86 100644 --- a/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMap.js +++ b/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMap.js @@ -60,15 +60,7 @@ const ProjectSummaryMap = ({ projectExtentGeoJSON }) => { * Let's throw an error intentionally if there are no features for a project. */ if (featureCount < 1) { - // Does this have implications for the rest of the app, or is this directive contained - // in this branch of the component hierarchy? - // stopReportingRuntimeErrors(); - - // Invoking this component without any features to render should produce an error. - // However, we should not rely on the Error handling to do the test to see if we - // want to render the map, which should be handled up a level in the component tree. - // This is for when we render this component in error, not in the normal course - // of the application. + // Throw an error if this component was called without features to render. throw Error("Map error: Cannot render or edit maps with no features"); } From 94ffc5a8e2d9f9d3a973058056540811a7aca0c9 Mon Sep 17 00:00:00 2001 From: Frank Hereford Date: Mon, 22 Nov 2021 09:16:08 -0600 Subject: [PATCH 4/7] Remove commented out import line --- .../projects/projectView/ProjectSummary/ProjectSummaryMap.js | 1 - 1 file changed, 1 deletion(-) diff --git a/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMap.js b/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMap.js index 2479db0f86..e7419592de 100644 --- a/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMap.js +++ b/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMap.js @@ -3,7 +3,6 @@ import ReactMapGL, { NavigationControl } from "react-map-gl"; import { Box, makeStyles } from "@material-ui/core"; import "mapbox-gl/dist/mapbox-gl.css"; import "react-map-gl-geocoder/dist/mapbox-gl-geocoder.css"; -//import { stopReportingRuntimeErrors } from "react-error-overlay"; import { createSummaryMapLayers, From 4adf901e619c3028ab4609ce48eaf3ae0554a88d Mon Sep 17 00:00:00 2001 From: Frank Hereford Date: Tue, 23 Nov 2021 15:09:22 -0600 Subject: [PATCH 5/7] Linting --- .../ProjectSummary/ProjectSummary.js | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummary.js b/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummary.js index 1c3fbff7c4..e58882d16e 100644 --- a/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummary.js +++ b/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummary.js @@ -24,7 +24,7 @@ import ProjectSummaryProjectDescription from "./ProjectSummaryProjectDescription import ProjectSummaryCurrentStatus from "./ProjectSummaryCurrentStatus"; import ProjectSummaryProjectECapris from "./ProjectSummaryProjectECapris"; -import { countFeatures } from "../../../../utils/mapHelpers" +import { countFeatures } from "../../../../utils/mapHelpers"; const useStyles = makeStyles(theme => ({ fieldGridItem: { @@ -105,20 +105,24 @@ const ProjectSummary = ({ loading, error, data, refetch }) => { projectFeatureRecords ); - if (projectFeatureRecords.length === 0 && !makeSureRefresh) + if (projectFeatureRecords.length === 0 && !makeSureRefresh) setMakeSureRefresh(true); const renderMap = () => { if (countFeatures(projectFeatureCollection) < 1) { - return + return ( + + ); } else { - return + return ( + + ); } - } + }; return ( From 89b172ed66727541c693b0a8d6209ee900e66117 Mon Sep 17 00:00:00 2001 From: Frank Hereford Date: Sun, 21 Nov 2021 10:53:58 -0600 Subject: [PATCH 6/7] Use console.debug() to report handled errors --- .../projectView/ProjectSummary/ProjectSummaryMapFallback.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMapFallback.js b/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMapFallback.js index 5bb43514da..c2f3c2e58d 100644 --- a/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMapFallback.js +++ b/moped-editor/src/views/projects/projectView/ProjectSummary/ProjectSummaryMapFallback.js @@ -52,8 +52,8 @@ const ProjectSummaryMapFallback = ({ error, mapData }) => { /** * Log whatever error there may be */ - console.error("MapDataError: ", error); - console.error("MapData: ", mapData); + console.debug("MapDataError: ", error); + console.debug("MapData: ", mapData); return ( From eb2a37b3847166e628114832a896ef8a80842fff Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 1 Dec 2021 18:46:45 +0000 Subject: [PATCH 7/7] Bump axios from 0.21.1 to 0.21.2 in /moped-editor Bumps [axios](https://github.com/axios/axios) from 0.21.1 to 0.21.2. - [Release notes](https://github.com/axios/axios/releases) - [Changelog](https://github.com/axios/axios/blob/master/CHANGELOG.md) - [Commits](https://github.com/axios/axios/compare/v0.21.1...v0.21.2) --- updated-dependencies: - dependency-name: axios dependency-type: direct:production ... Signed-off-by: dependabot[bot] --- moped-editor/package-lock.json | 72 ++++++++++++++++++++++++++-------- 1 file changed, 55 insertions(+), 17 deletions(-) diff --git a/moped-editor/package-lock.json b/moped-editor/package-lock.json index b9e5dbf0fc..af9455be32 100644 --- a/moped-editor/package-lock.json +++ b/moped-editor/package-lock.json @@ -1,12 +1,12 @@ { "name": "atd-moped-editor", - "version": "0.8.0", + "version": "0.11.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "atd-moped-editor", - "version": "0.8.0", + "version": "0.11.0", "dependencies": { "@apollo/client": "^3.3.6", "@hookform/devtools": "^2.2.1", @@ -23,7 +23,7 @@ "apollo-boost": "^0.4.9", "atd-kickstand": "github:cityofaustin/atd-kickstand#f71e4d3d6ddea09263410d93432c254ef2ed1793", "aws-amplify": "^3.3.4", - "axios": "^0.21.1", + "axios": "^0.21.2", "chart.js": "^2.9.4", "clsx": "^1.1.1", "date-fns": "^2.23.0", @@ -994,6 +994,14 @@ "js-cookie": "^2.2.1" } }, + "node_modules/@aws-amplify/api/node_modules/axios": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "dependencies": { + "follow-redirects": "^1.10.0" + } + }, "node_modules/@aws-amplify/api/node_modules/tslib": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", @@ -4253,6 +4261,14 @@ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz", "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg==" }, + "node_modules/@aws-amplify/storage/node_modules/axios": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "dependencies": { + "follow-redirects": "^1.10.0" + } + }, "node_modules/@aws-amplify/storage/node_modules/tslib": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", @@ -9530,11 +9546,11 @@ } }, "node_modules/axios": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", - "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "version": "0.21.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.2.tgz", + "integrity": "sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==", "dependencies": { - "follow-redirects": "^1.10.0" + "follow-redirects": "^1.14.0" } }, "node_modules/axobject-query": { @@ -14332,9 +14348,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.12.1.tgz", - "integrity": "sha512-tmRv0AVuR7ZyouUHLeNSiO6pqulF7dYa3s19c6t+wz9LD69/uSzdMxJ2S91nTI9U3rt/IldxpzMOFejp6f0hjg==", + "version": "1.14.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz", + "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==", "funding": [ { "type": "individual", @@ -14343,6 +14359,11 @@ ], "engines": { "node": ">=4.0" + }, + "peerDependenciesMeta": { + "debug": { + "optional": true + } } }, "node_modules/for-in": { @@ -27266,6 +27287,14 @@ "js-cookie": "^2.2.1" } }, + "axios": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "requires": { + "follow-redirects": "^1.10.0" + } + }, "tslib": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", @@ -30436,6 +30465,14 @@ } } }, + "axios": { + "version": "0.21.1", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", + "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "requires": { + "follow-redirects": "^1.10.0" + } + }, "tslib": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.1.0.tgz", @@ -34849,6 +34886,7 @@ }, "atd-kickstand": { "version": "git+ssh://git@github.com/cityofaustin/atd-kickstand.git#f71e4d3d6ddea09263410d93432c254ef2ed1793", + "integrity": "sha512-V/G8P2fUWnTgacMxZCn9Q3x2FoFMHhivZk9lfMok1/IP2Rh1iyWYhmkChN4uq/T6nmUZP3VR0PuUJdyuHPbipw==", "from": "atd-kickstand@github:cityofaustin/atd-kickstand#f71e4d3d6ddea09263410d93432c254ef2ed1793", "requires": {} }, @@ -34906,11 +34944,11 @@ "integrity": "sha512-5P0QZ6J5xGikH780pghEdbEKijCTrruK9KxtPZCFWUpef0f6GipO+xEZ5GKCb020mmqgbiNO6TcA55CriL784Q==" }, "axios": { - "version": "0.21.1", - "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz", - "integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==", + "version": "0.21.2", + "resolved": "https://registry.npmjs.org/axios/-/axios-0.21.2.tgz", + "integrity": "sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==", "requires": { - "follow-redirects": "^1.10.0" + "follow-redirects": "^1.14.0" } }, "axobject-query": { @@ -38838,9 +38876,9 @@ "integrity": "sha512-eNMNr5exLoavuAMhIUVsOKF79SWd/zG104ef6sxBTSw+cZc6BXdQXDvYcGvp0VbxVVSp1XDUNoz7mg1xMtSznA==" }, "follow-redirects": { - "version": "1.12.1", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.12.1.tgz", - "integrity": "sha512-tmRv0AVuR7ZyouUHLeNSiO6pqulF7dYa3s19c6t+wz9LD69/uSzdMxJ2S91nTI9U3rt/IldxpzMOFejp6f0hjg==" + "version": "1.14.5", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.5.tgz", + "integrity": "sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==" }, "for-in": { "version": "1.0.2",