From f120266f9efe2e20a01dbffb710c36e06d15df47 Mon Sep 17 00:00:00 2001 From: Maurice Date: Sat, 12 Sep 2026 13:56:49 +0200 Subject: [PATCH] fix(pwa): cache Amap tiles like the other raster presets Without a Workbox rule for is.autonavi.com the offline pre-download fetched the tiles and stored none of them, the hole #2180 closed for the OpenStreetMap DE and Stadia presets. --- client/vite.config.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/client/vite.config.js b/client/vite.config.js index c20f0e2e9..ded3c086d 100644 --- a/client/vite.config.js +++ b/client/vite.config.js @@ -126,6 +126,18 @@ export default defineConfig(({ mode }) => ({ cacheableResponse: { statuses: [0, 200] }, }, }, + { + // Amap road and satellite presets, served from the shard hosts under + // is.autonavi.com (src/constants/mapDefaults.ts). Without a rule here + // they would be the #2180 hole all over again. + urlPattern: /^https:\/\/(?:[a-z0-9]+\.)?is\.autonavi\.com\/.*/i, + handler: 'CacheFirst', + options: { + cacheName: 'map-tiles', + expiration: { maxEntries: 12288, maxAgeSeconds: 30 * 24 * 60 * 60 }, + cacheableResponse: { statuses: [0, 200] }, + }, + }, { // The GL style DOCUMENT, for both providers. It has to be matched // before the tile rules below, because Workbox takes the first route