fix(subscriptions): improve reliability of list loading and button responsiveness

- Implemented optimistic UI updates for the channel subscribe button to improve responsiveness.
- Fixed a race condition in `js/subscriptions.js` and `js/services/hashtagPreferencesService.js` where lists were wiped on refresh due to `profileCache.activePubkey` not being initialized in time. Now using `profileCache.getProfileData(pubkey, ...)` to ensure the correct cache entry is loaded.
- Validated with targeted unit tests.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-01-26 18:56:34 +00:00
1 parent 560dcf96b0
commit 73541168f7
4 files changed
+81 -3

No files matched your search

+1 -1
View File
@@ -310,7 +310,7 @@ class SubscriptionsManager {
const normalizedUserPubkey = normalizeHexPubkey(userPubkey) || userPubkey;
// 1. Attempt to load from cache first
const cached = profileCache.get("subscriptions");
const cached = profileCache.getProfileData(normalizedUserPubkey, "subscriptions");
if (Array.isArray(cached)) {
devLogger.log("[SubscriptionsManager] Loaded subscriptions from cache.");
this.subscribedPubkeys = new Set(cached);