diff --git a/js/accessControl.js b/js/accessControl.js index 96dd35d8..3f9d7cd9 100644 --- a/js/accessControl.js +++ b/js/accessControl.js @@ -433,22 +433,20 @@ class AccessControl { } async ensureReady() { + // If not loaded and not already refreshing, kick off a background refresh. + // We do NOT await this promise, allowing the application to proceed immediately. + // Reactive updates (e.g. onBlacklistChange) will handle the UI state when data arrives. if (!this.hasLoaded && !this._isRefreshing) { - this.refresh(); + this.refresh().catch((error) => { + userLogger.warn( + "[accessControl] Background refresh failed:", + error, + ); + }); } - try { - await this._refreshPromise; - userLogger.info("[accessControl] ensureReady resolved"); - } catch (error) { - if (!this.hasLoaded) { - userLogger.warn("[accessControl] ensureReady retry"); - await this.refresh(); - await this._refreshPromise; - } else { - throw error; - } - } + // Always resolve immediately to prevent blocking application startup. + return Promise.resolve(); } whitelistMode() { diff --git a/js/app.js b/js/app.js index 6a1fa2d4..ca889f5a 100644 --- a/js/app.js +++ b/js/app.js @@ -436,9 +436,20 @@ class Application { profileModalPromise, ]); - const nostrInitPromise = nostrClient.init(); + // Initialize the pool early to unblock bootstrapTrustedSeeds, + // but do NOT await the full connection process here. + try { + await nostrClient.ensurePool(); + } catch (poolError) { + devLogger.warn("[app.init()] Pool ensure failed:", poolError); + } - await Promise.all([modalBootstrapPromise, nostrInitPromise]); + // Kick off relay connection in the background. + const nostrInitPromise = nostrClient.init().catch((err) => { + devLogger.warn("[app.init()] Background nostrClient.init failed:", err); + }); + + await modalBootstrapPromise; try { await bootstrapTrustedSeeds();