fix(watch-history): add manual refresh and fix dynamic pulling

This commit addresses issues with the watch history not updating dynamically and adds a manual refresh mechanism.

Changes:
- Added a "Refresh" button to the watch history view in `views/history.html` and `js/historyView.js`.
- Updated `watchHistoryService.js` to accept a `forceRefresh` option in `loadLatest`, which bypasses the cache freshness check and triggers a relay fetch.
- Updated `js/feedEngine/watchHistoryFeed.js` to propagate the `forceRefresh` flag from the runtime context to the service.
- Added user feedback (toast messages and logs) for "Clear Local History" and "Republish Now" actions.
- Updated `tests/watch-history.test.mjs` to align with the new `fetchHistory` signature.
This commit is contained in:
google-labs-jules[bot] committed 2026-01-07 14:05:21 +00:00
1 parent a5994f1380
commit c322fcee14
5 files changed
+87 -18

No files matched your search

+7 -1
View File
@@ -174,13 +174,19 @@ function createWatchHistorySource({ service = watchHistoryService } = {}) {
context?.runtime?.actor,
);
const forceRefresh =
context?.runtime?.watchHistory?.forceRefresh === true ||
context?.runtime?.forceRefresh === true;
if (!service || typeof service.loadLatest !== "function") {
return [];
}
let items = [];
try {
items = await Promise.resolve(service.loadLatest(actor || undefined));
items = await Promise.resolve(
service.loadLatest(actor || undefined, { forceRefresh })
);
} catch (error) {
context?.log?.("[watch-history-feed] Failed to load history", error);
items = [];