fix(storm-intel): hailIn TDZ crash, restore 36mo fetch, Go button for radius

- Fix ReferenceError: hailIn was used before declaration in featureToEvent,
  causing every SV event to throw and fall back to empty mock data
- Restore IEM fetch window to 36 months so events are available for all range chips
- Radius input now has explicit Go button (Enter key also applies); draft value
  shows hint until applied so accidental keystrokes don't retrigger search
This commit is contained in:
Satyam-Rastogi
2026-05-19 00:51:44 +05:30
parent a6d3997d07
commit 0b8229d46f
2 changed files with 23 additions and 10 deletions
+3 -3
View File
@@ -70,14 +70,14 @@ function featureToEvent(feature, idx) {
const polygon = rawCoords.map(([lon, lat]) => [lat, lon]); // → Leaflet [lat,lon]
const hailIn = p.hailtag ? parseFloat(p.hailtag) : null;
const type = ph === 'TO' ? 'tornado'
: ph === 'FF' ? 'flood'
: ph === 'WS' || ph === 'BZ' ? 'snow'
: ph === 'WW' || ph === 'IS' ? 'ice'
: hailIn !== null ? 'hail'
: 'wind';
const hailIn = p.hailtag ? parseFloat(p.hailtag) : null;
const severity = ph === 'TO' ? 'severe'
: hailIn !== null
? (hailIn >= 2.0 ? 'severe' : hailIn >= 1.5 ? 'significant' : hailIn >= 1.0 ? 'moderate' : 'trace')
@@ -101,7 +101,7 @@ function featureToEvent(feature, idx) {
async function fetchIEMEvents() {
const now = new Date();
const cutoff = new Date(now.getTime() - 6 * 30.44 * 86400000);
const cutoff = new Date(now.getTime() - 36 * 30.44 * 86400000);
const url = `${IEM_SBW}?sts=${encodeURIComponent(cutoff.toISOString())}&ets=${encodeURIComponent(now.toISOString())}&wfo=${WFO}`;
const res = await fetch(url);