Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

fix: the iOS tile trim handles its own failure instead of an empty catch, and the weight test's slow row saves without an async prop

Maurice1400b5d308bc
diff --git a/client/src/components/Packing/PackingListPanelWeightInput.test.tsx b/client/src/components/Packing/PackingListPanelWeightInput.test.tsx
index 9ff21668c..b770de669 100644
--- a/client/src/components/Packing/PackingListPanelWeightInput.test.tsx
+++ b/client/src/components/Packing/PackingListPanelWeightInput.test.tsx
@@ -11,10 +11,9 @@ function SlowRow({ onSave }: { onSave: (grams: number | null) => void }) {
<WeightInput
value={stored}
width={36}
- onSave={async (grams) => {
+ onSave={(grams) => {
onSave(grams);
- await new Promise((resolve) => setTimeout(resolve, 300));
- setStored(grams);
+ setTimeout(() => setStored(grams), 300);
}}
/>
);
diff --git a/client/src/sync/tilePrefetcher.ts b/client/src/sync/tilePrefetcher.ts
index 45f3ff0a5..86837385e 100644
--- a/client/src/sync/tilePrefetcher.ts
+++ b/client/src/sync/tilePrefetcher.ts
@@ -381,21 +381,24 @@ export async function trimTileCacheForIos(now = Date.now()): Promise<number> {
} catch {
return 0
}
- const cache = await openTileCache()
- if (!cache) return 0
- const keys = await cache.keys()
- const surplus = keys.slice(0, Math.max(0, keys.length - IOS_MAX_TILES))
- for (const request of surplus) await cache.delete(request)
- return surplus.length
+ try {
+ const cache = await openTileCache()
+ if (!cache) return 0
+ const keys = await cache.keys()
+ const surplus = keys.slice(0, Math.max(0, keys.length - IOS_MAX_TILES))
+ for (const request of surplus) await cache.delete(request)
+ return surplus.length
+ } catch {
+ // Cache Storage refused: the tiles stay as they are and tomorrow tries again.
+ return 0
+ }
}
/** Trims the iOS tile cache once the app has started, never in the way of its first screens. */
export function scheduleTileCacheTrim(delayMs = 15_000): void {
if (!isIosDevice() || isNativeIos()) return
window.setTimeout(() => {
- trimTileCacheForIos().catch(() => {
- /* Cache Storage unavailable: nothing to trim */
- })
+ void trimTileCacheForIos()
}, delayMs)
}