Skip to content

Commit 3bb47ac

Browse files
authored
fix(bootstrap): reset cached tier timestamp when live data arrives with missing keys (koala73#2028)
Previously, fetchTier preserved the old IDB updatedAt when filling missing keys from cache (source: mixed). This caused the stale timestamp to be round-tripped back into IndexedDB on every load, making the CACHED banner grow progressively staler (7h, 7h10m, 7h20m, ...) across sessions even when live data was being fetched successfully. Now the IDB is written with Date.now() and the in-memory tierState also reflects the current time, so the brief pre-markBootstrapAsLive flash shows "just now" instead of the preserved stale age.
1 parent d2c8562 commit 3bb47ac

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

src/services/bootstrap.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,7 @@ async function fetchTier(tier: 'fast' | 'slow', signal: AbortSignal): Promise<Bo
144144
}
145145
}
146146
if (filledAny) {
147-
tierState = { source: 'mixed', updatedAt: cached.updatedAt };
148-
saveUpdatedAt = cached.updatedAt; // preserve staleness: don't let cache write reset the age clock
147+
tierState = { source: 'mixed', updatedAt: Date.now() };
149148
}
150149
}
151150
}

0 commit comments

Comments
 (0)