diff --git a/js/historyView.js b/js/historyView.js index 5ef319dd..4d2e9bbe 100644 --- a/js/historyView.js +++ b/js/historyView.js @@ -2409,6 +2409,10 @@ export function createWatchHistoryRenderer(config = {}) { await this.init(options); return; } + if (options.actor !== state.actor) { + await this.refresh(options); + return; + } refreshElements(); updateFeatureBanner(); if (!state.featureEnabled) { diff --git a/js/subscriptions.js b/js/subscriptions.js index 1cc1be18..a7385d96 100644 --- a/js/subscriptions.js +++ b/js/subscriptions.js @@ -224,6 +224,7 @@ class SubscriptionsManager { constructor() { this.subscribedPubkeys = new Set(); this.subsEventId = null; + this.currentUserPubkey = null; this.loaded = false; this.loadingPromise = null; this.subscriptionListView = null; @@ -379,19 +380,30 @@ class SubscriptionsManager { const normalized = parseSubscriptionPlaintext(decryptedStr); this.subscribedPubkeys = new Set(normalized); + this.currentUserPubkey = normalizedUserPubkey; this.loaded = true; } catch (err) { userLogger.error("[SubscriptionsManager] Failed to load subs:", err); } } + reset() { + this.subscribedPubkeys.clear(); + this.subsEventId = null; + this.currentUserPubkey = null; + this.loaded = false; + this.lastRunOptions = null; + this.lastResult = null; + this.hasRenderedOnce = false; + } + async ensureLoaded(actorHex) { - if (this.loaded) { + const normalizedActor = normalizeHexPubkey(actorHex) || actorHex; + if (!normalizedActor) { return; } - const normalizedActor = normalizeHexPubkey(actorHex) || actorHex; - if (!normalizedActor) { + if (this.loaded && this.currentUserPubkey === normalizedActor) { return; } diff --git a/js/ui/profileModalController.js b/js/ui/profileModalController.js index 404330fa..4c48e79c 100644 --- a/js/ui/profileModalController.js +++ b/js/ui/profileModalController.js @@ -8828,6 +8828,20 @@ export class ProfileModalController { userLogger.warn("Failed to refresh admin pane after logout:", error); } + if ( + this.subscriptionsService && + typeof this.subscriptionsService.reset === "function" + ) { + try { + this.subscriptionsService.reset(); + } catch (error) { + devLogger.warn( + "[profileModal] Failed to reset subscriptions service on logout:", + error, + ); + } + } + this.populateBlockedList(); this.clearSubscriptionsList(); this.clearFriendsList();