From f89e71fa97ce2384aed5bf7a36723ca5699a4b18 Mon Sep 17 00:00:00 2001 From: Thad Kerosky Date: Wed, 29 May 2024 00:28:18 +0000 Subject: [PATCH 1/4] fix geocoder which was accumulating state unnecessarily Co-authored-by: Camden Blatchly Co-authored-by: plocket Co-authored-by: Leopardfoot --- heat-stack/app/routes/_heat+/single.tsx | 2 +- heat-stack/app/utils/GeocodeUtil.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/heat-stack/app/routes/_heat+/single.tsx b/heat-stack/app/routes/_heat+/single.tsx index 0d0dda3b..f709c54a 100644 --- a/heat-stack/app/routes/_heat+/single.tsx +++ b/heat-stack/app/routes/_heat+/single.tsx @@ -27,7 +27,7 @@ import * as pyodideModule from 'pyodide' // - [x] import pyodide into single.tsx and run it with genny // - [x] Add to README: don't forget `npm run buildpy` to build rules engine into `public/pyodide-env` if you start a new codingspace or on local. // - [x] figure out how to set field defaults with Conform to speed up trials (defaultValue prop on input doesn't work) https://conform.guide/api/react/useForm -// - [ ] (To reproduce: Fill out and submit form and go back and submit form again) How do we stop the geocoder helper from concatenating everyone's past submitted addresses onto querystring in single.tsx action? +// - [x] (To reproduce: Fill out and submit form and go back and submit form again) How do we stop the geocoder helper from concatenating everyone's past submitted addresses onto querystring in single.tsx action? // example: [MSW] Warning: intercepted a request without a matching request handler: GET https://geocoding.geo.census.gov/geocoder/locations/onelineaddress?address=1+Broadway%2C+Cambridge%2C+MA+02142&format=json&benchmark=2020&address=1+Broadway%2C+Cambridge%2C+MA+02142&format=json&benchmark=2020 // - [ ] Zod error at these three lines in Genny because the .optional() zod setting (see ./types/index.tsx) is getting lost somehow, refactor as much of genny away as possible: thermostatSetPoint: oldSummaryInput.thermostat_set_point, setbackTemperature: oldSummaryInput.setback_temperature, setbackHoursPerDay: oldSummaryInput.setback_hours_per_day, // - [ ] Display Conform's form-wide errors, currently thrown away (if we think of a use case - 2 fields conflicting...) diff --git a/heat-stack/app/utils/GeocodeUtil.js b/heat-stack/app/utils/GeocodeUtil.js index 22be44e6..6fad24b3 100644 --- a/heat-stack/app/utils/GeocodeUtil.js +++ b/heat-stack/app/utils/GeocodeUtil.js @@ -1,6 +1,5 @@ const BASE_URL = "https://geocoding.geo.census.gov"; const ADDRESS_ENDPOINT = "/geocoder/locations/onelineaddress"; -const params = new URLSearchParams(); class GeocodeUtil { @@ -11,6 +10,8 @@ class GeocodeUtil { * This is the happiest of paths, with hardcoded values also... */ async getLL(address) { + const params = new URLSearchParams(); + params.append("address",address); params.append("format","json"); params.append("benchmark",2020); From 80ad76fefe7a078da3263241d43b5d4905c8ba50 Mon Sep 17 00:00:00 2001 From: Thad Kerosky Date: Wed, 29 May 2024 00:42:20 +0000 Subject: [PATCH 2/4] switch key variables in types from camelCase to snake_case --- .../CurrentHeatingSystem.tsx | 48 +++++++------- .../HeatLoadAnalysis.tsx | 4 +- .../CaseSummaryComponents/HomeInformation.tsx | 8 +-- heat-stack/app/routes/_heat+/Inputs1.tsx | 4 +- heat-stack/app/routes/_heat+/single.tsx | 64 +++++++++---------- heat-stack/types/index.ts | 14 ++-- 6 files changed, 71 insertions(+), 71 deletions(-) diff --git a/heat-stack/app/components/ui/heat/CaseSummaryComponents/CurrentHeatingSystem.tsx b/heat-stack/app/components/ui/heat/CaseSummaryComponents/CurrentHeatingSystem.tsx index 4866f871..11169f4f 100644 --- a/heat-stack/app/components/ui/heat/CaseSummaryComponents/CurrentHeatingSystem.tsx +++ b/heat-stack/app/components/ui/heat/CaseSummaryComponents/CurrentHeatingSystem.tsx @@ -23,46 +23,46 @@ export function CurrentHeatingSystem(props: CurrentHeatingSystemProps) { {/*
*/}
{' '} -
-