mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 12:52:26 +00:00
perf(watch-history): load in background; re-run For You when it resolves
The For You feed awaited watchHistoryService.loadLatest() before rendering, and loadLatest blocked on the full ~1500-item watch-history fetch on a cold load even with allowStale:true (the `!allowStale || !hasCachedItems` guard awaited whenever there was no cache). So the main feed froze behind the entire watch-history resolution, and nothing re-ran the feed once history finished loading — watched videos were never suppressed and watch-history tags never applied until a manual refresh. - watchHistoryService.loadLatest: allowStale callers now NEVER block. On a cold load the refresh is kicked off in the background and the call returns immediately with whatever is available (cached items, else the local queue). - feedCoordinator.subscribeWatchHistoryFeedRefresh: subscribes to the "fingerprint" event and, when the For You feed is active, debounced-re-runs it so newly-resolved watched videos are suppressed and tags applied. Wired in at bootstrap alongside feed registration. The re-run reads the now-fresh cache (no further refresh scheduled), so there is no loop. Adds feedCoordinatorWatchHistoryRefresh.test.mjs (debounced single refresh while active; no refresh when inactive; idempotent subscription). Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
be602a5a10
commit
52ceb4f211
5 files changed
+172
-3
No files matched your search
@@ -275,6 +275,8 @@ export default class ApplicationBootstrap {
|
||||
app.registerExploreFeed();
|
||||
app.registerSubscriptionsFeed();
|
||||
app.registerWatchHistoryFeed();
|
||||
// Re-run the For You feed when background watch-history resolution completes.
|
||||
app.subscribeWatchHistoryFeedRefresh();
|
||||
|
||||
app.watchHistoryController = new WatchHistoryController({
|
||||
watchHistoryService,
|
||||
|
||||
Reference in new issue
Block a user