From 3d0564feead4ec3a11bfa7168c89defab988cac3 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Fri, 12 Jun 2026 20:32:03 -0400 Subject: [PATCH] fix(auth): stop eagerly preloading watch history on login MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The eager watch-history preload (0c8a17e3) — even deferred after the critical lists — saturated the serialized nip-07 extension with ~150+ chunk decrypts for ~18s after login. If the profile modal was opened in that window, its hashtag / subscription / DM loads competed for the extension and failed/timed out, and DMs felt broken. Revert to lazy loading: watch history loads when the For You feed or History view is opened, keeping login light so the critical lists and the modal work. Re-add an eager preload only after the cold-load decrypt cost is reduced (task #14). Co-Authored-By: Claude Opus 4.8 --- js/app/authSessionCoordinator.js | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/js/app/authSessionCoordinator.js b/js/app/authSessionCoordinator.js index 1d9d9103..0e3aae54 100644 --- a/js/app/authSessionCoordinator.js +++ b/js/app/authSessionCoordinator.js @@ -12,7 +12,6 @@ import { clearDecryptionSchemeCache } from "../nostr/decryptionSchemeCache.js"; import { clearWatchHistoryConversationKeyCache } from "../nostr/watchHistory.js"; import { clearWatchHistoryDecryptedChunkCache } from "../nostr/watchHistoryDecryptCache.js"; -import watchHistoryService from "../watchHistoryService.js"; import { FEED_TYPES } from "../constants.js"; /** @@ -493,22 +492,12 @@ export function createAuthSessionCoordinator(deps) { const taskOutcomes = await Promise.all(parallelListTasks); - // Warm watch history AFTER the critical lists decrypt: the serialized - // nip-07 extension + a cold watch history (~150+ decrypts) starved them. - if ( - activePubkey && - watchHistoryService && - typeof watchHistoryService.loadLatest === "function" - ) { - Promise.resolve( - watchHistoryService.loadLatest(activePubkey, { allowStale: true }), - ).catch((error) => { - devLogger.warn( - "[auth] Background watch-history preload failed:", - error, - ); - }); - } + // NOTE: watch history is intentionally NOT eagerly preloaded on login. + // A cold watch history is ~150+ serialized nip-07 decrypts; preloading it + // here (even after the lists) saturated the extension and starved the + // profile modal's hashtag/subscription/DM loads. It now loads lazily when + // the For You feed or History view is opened. Re-enable an eager preload + // only once the cold-load decrypt cost is reduced (see task: ~180 calls). const requiredTaskOutcomes = taskOutcomes.filter((outcome) => ["blocks", "subscriptions", "hashtags"].includes(outcome.name),