Skip to content

fix: cache open-meteo and timezone requests for offline use - #191

Merged
aeharding merged 1 commit into
mainfrom
fix/offline-openmeteo-cache
Aug 19, 2026
Merged

fix: cache open-meteo and timezone requests for offline use#191
aeharding merged 1 commit into
mainfrom
fix/offline-openmeteo-cache

Conversation

@aeharding

Copy link
Copy Markdown
Owner

Going offline loaded the app shell but no forecast data.

The offline cache is the Workbox runtime-caching config, which matches by URL prefix. Winds aloft used to be fetched from /api/rap, covered by a 4-hour NetworkFirst rule. b9d12e6 removed rucsoundings support and deleted that rule, but the replacement source (Open-Meteo, at /api/openmeteo/forecast) never had one.

That made the failure total rather than partial: getWeather awaits loadWindsAloft() before anything else, so when that request throws offline the thunk rejects and alerts, TAF, and the NWS forecast never load — even though those endpoints were still cached.

  • Add /api/openmeteo.*NetworkFirst, 4 hours, matching the other weather caches. Covers both the winds-aloft and hourly-weather calls.
  • Add /api/timezone.*NetworkFirst, 7 days. Also uncached; outside the US it is the only timezone source, so offline fell back to "using local time".
  • Drop a duplicate /api/weather rule — two identical entries existed and the second was unreachable.

Verified with a fresh pnpm build: the generated service-worker.js registers apiOpenMeteoCache and apiTimezoneCache, with a single apiWeatherCache route.

Note: this only takes effect once the new service worker activates and the app is loaded online once to populate the cache.

@aeharding
aeharding merged commit 61ba48b into main Aug 19, 2026
1 check passed
@aeharding
aeharding deleted the fix/offline-openmeteo-cache branch August 19, 2026 00:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant