From 46ef2b8123847a99b208f355ca303c462f44e7bb Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Wed, 8 Oct 2025 08:11:26 -0400 Subject: [PATCH] Ensure watch history loads include full lists by default --- js/historyView.js | 4 +++- js/watchHistoryService.js | 5 ++++- tests/watch-history.test.mjs | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/js/historyView.js b/js/historyView.js index 1bf8082b..bb5e58e8 100644 --- a/js/historyView.js +++ b/js/historyView.js @@ -572,7 +572,9 @@ export function createWatchHistoryRenderer(config = {}) { }); return engine.run("watch-history", { runtime }); } - const items = await watchHistoryService.loadLatest(actorInput); + const items = await watchHistoryService.loadLatest(actorInput, { + allowStale: true, + }); const normalized = normalizeHistoryItems(items); return { items: normalized, metadata: { engine: "service-fallback" } }; }, diff --git a/js/watchHistoryService.js b/js/watchHistoryService.js index a201cd6f..e40f855d 100644 --- a/js/watchHistoryService.js +++ b/js/watchHistoryService.js @@ -1250,7 +1250,10 @@ async function loadLatest(actorInput, options = {}) { const normalizedOptions = options && typeof options === "object" ? options : {}; - const allowStale = normalizedOptions.allowStale !== false; + // Only callers that can react to a later fingerprint update should opt into + // stale cache reads; everyone else waits for the fresh list so they do not + // miss entries. + const allowStale = normalizedOptions.allowStale === true; if (!isFeatureEnabled(actorKey)) { if (!state.restored) { diff --git a/tests/watch-history.test.mjs b/tests/watch-history.test.mjs index 56a201b0..b913154e 100644 --- a/tests/watch-history.test.mjs +++ b/tests/watch-history.test.mjs @@ -1061,7 +1061,9 @@ async function testWatchHistoryStaleCacheRefresh() { return refreshedItems; }; - const staleResult = await watchHistoryService.loadLatest(actor); + const staleResult = await watchHistoryService.loadLatest(actor, { + allowStale: true, + }); assert.equal( resolveCallCount, 1,