mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-10-28 16:32:28 +00:00
Fix subscriptions loading issues and sidebar link visibility race condition.
- Updated `shimLegacySimplePoolMethods` in `js/nostr/toolkit.js` to correctly handle `nostr-tools` v2 subscription closers (which are functions) in `unsub`. This prevents subscription leaks that were causing relays to reject new requests, leading to empty subscription lists. - Updated `bootstrapInterface` in `js/index.js` to await `applicationReadyPromise` before attempting to hydrate the sidebar navigation. This fixes a race condition where the sidebar "Subscriptions" link would remain hidden because the application auth state wasn't fully initialized when the sidebar was rendered.
This commit is contained in:
1 parent
778b35874d
commit
eb8b3c70dd
2 files changed
+11
-1
No files matched your search
@@ -621,6 +621,12 @@ async function bootstrapInterface() {
|
||||
await loadSidebar("components/sidebar.html", "sidebarContainer");
|
||||
devLogger.log("Sidebar loaded.");
|
||||
|
||||
try {
|
||||
await applicationReadyPromise;
|
||||
} catch (error) {
|
||||
// fall through
|
||||
}
|
||||
|
||||
if (application && typeof application.hydrateSidebarNavigation === "function") {
|
||||
try {
|
||||
application.hydrateSidebarNavigation();
|
||||
|
||||
+5
-1
@@ -522,7 +522,11 @@ export function shimLegacySimplePoolMethods(pool) {
|
||||
}
|
||||
closed = true;
|
||||
try {
|
||||
closer?.close?.("closed by caller");
|
||||
if (typeof closer === "function") {
|
||||
closer();
|
||||
} else if (closer && typeof closer.close === "function") {
|
||||
closer.close("closed by caller");
|
||||
}
|
||||
} catch (error) {
|
||||
devLogger.warn("[nostr] Failed to close SimplePool subscription.", error);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user