[object Object]

← back to Homesonspec

homesonspec/mobile: Cycle 3 Cody fixes — enrich gates on staleness alone + always-stamps attempt (fixes never-refresh + 8MB-per-open fetch-storm for homes not in /api/map); adaptive-icon transparent bg (Android mask-safe)

57f4a18de861522141d9c227289d3216a7f0d2e9 · 2026-08-06 14:11:12 -0700 · Steve

Files touched

Diff

commit 57f4a18de861522141d9c227289d3216a7f0d2e9
Author: Steve <steve@designerwallcoverings.com>
Date:   Thu Aug 6 14:11:12 2026 -0700

    homesonspec/mobile: Cycle 3 Cody fixes — enrich gates on staleness alone + always-stamps attempt (fixes never-refresh + 8MB-per-open fetch-storm for homes not in /api/map); adaptive-icon transparent bg (Android mask-safe)
---
 apps/mobile/assets/adaptive-icon.png | Bin 6752 -> 6041 bytes
 apps/mobile/lib/storage.ts           |  26 +++++++++++++++-----------
 2 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/apps/mobile/assets/adaptive-icon.png b/apps/mobile/assets/adaptive-icon.png
index 0a3f46cc..b3863b63 100644
Binary files a/apps/mobile/assets/adaptive-icon.png and b/apps/mobile/assets/adaptive-icon.png differ
diff --git a/apps/mobile/lib/storage.ts b/apps/mobile/lib/storage.ts
index 0f152795..eb12732d 100644
--- a/apps/mobile/lib/storage.ts
+++ b/apps/mobile/lib/storage.ts
@@ -94,25 +94,29 @@ export async function clearAllSaved(): Promise<void> {
  */
 export async function enrichSavedHomes(): Promise<SavedHome[]> {
   const all = await readAll();
-  const HOUR_MS = 60 * 60 * 1000;
+  const TTL_MS = 12 * 60 * 60 * 1000; // refresh at most every 12h per home
   let changed = false;
   for (const h of all) {
+    // Gate on staleness ALONE (not on missing-field): this both (a) refreshes a
+    // complete home's status if it changed upstream, and (b) rate-limits retries
+    // for a home whose id isn't in /api/map — we stamp the ATTEMPT below even on a
+    // null lookup, so a missing home can't trigger an 8MB fetch on every open.
     const stale =
       !h.lastEnrichedAt ||
-      Date.now() - new Date(h.lastEnrichedAt).getTime() > HOUR_MS;
-    const needs = h.price == null || !h.location || !h.status;
-    if (!needs || !stale) continue;
+      Date.now() - new Date(h.lastEnrichedAt).getTime() > TTL_MS;
+    if (!stale) continue;
     try {
       const m = await getHomeById(h.id);
-      if (!m) continue;
-      if (h.price == null && m.p != null) h.price = m.p;
-      if (!h.location && m.c) h.location = m.c;
-      if (!h.status && m.s) h.status = m.s;
-      if (!h.builderSlug && m.bl) h.builderSlug = m.bl;
-      h.lastEnrichedAt = new Date().toISOString();
+      h.lastEnrichedAt = new Date().toISOString(); // stamp the attempt regardless
       changed = true;
+      if (m) {
+        if (m.p != null) h.price = m.p;
+        if (m.c) h.location = m.c;
+        if (m.s) h.status = m.s;
+        if (!h.builderSlug && m.bl) h.builderSlug = m.bl;
+      }
     } catch {
-      // best-effort: leave this home as-is
+      // best-effort: leave this home as-is; it stays stale and retries next window
     }
   }
   if (changed) await writeAll(all);

← 24cb9a13 homesonspec/mobile: Cycle 3 — enrich Saved by id from /api/m  ·  back to Homesonspec  ·  auto-data-snapshot: 2026-08-06T16:03:07 (1 data files) — app 23315d37 →