From 14d7423e29765256b80e92983771f272487c77ba Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 14:25:22 +0000 Subject: [PATCH 1/2] Remove blocking access control checks to fix slow initial video loading --- js/app.js | 2 +- js/services/nostrService.js | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/js/app.js b/js/app.js index acc7d99a..5c27aad9 100644 --- a/js/app.js +++ b/js/app.js @@ -494,7 +494,7 @@ class Application { }) : Promise.resolve(null); - await Promise.all([accessControlPromise, adminPanePromise]); + // await Promise.all([accessControlPromise, adminPanePromise]); const syncSessionActorBlacklist = async (trigger) => { if (this.pubkey) { diff --git a/js/services/nostrService.js b/js/services/nostrService.js index 7a5ea3f0..b966bba5 100644 --- a/js/services/nostrService.js +++ b/js/services/nostrService.js @@ -1104,7 +1104,12 @@ export class NostrService { this.ensureInitialLoadDeferred(); try { - await this.ensureAccessControlReady(); + this.ensureAccessControlReady().catch((error) => { + userLogger.warn( + "[nostrService] Background access control ready check failed:", + error + ); + }); if (forceFetch) { this.clearVideoSubscription(); From bdc86aaef600f9b9deabb75163b79a533fb391dd Mon Sep 17 00:00:00 2001 From: "google-labs-jules[bot]" <161369871+google-labs-jules[bot]@users.noreply.github.com> Date: Tue, 13 Jan 2026 14:48:56 +0000 Subject: [PATCH 2/2] Fix future timestamp bug and improve loading spinner UX --- js/app.js | 25 +++++++++++++++---------- js/nostr/client.js | 3 ++- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/js/app.js b/js/app.js index 5c27aad9..f54687b3 100644 --- a/js/app.js +++ b/js/app.js @@ -2698,17 +2698,15 @@ class Application { typeof reason === "string" && reason.trim() ? reason.trim() : undefined; if (typeof moderationService?.awaitUserBlockRefresh === "function") { - try { - await moderationService.awaitUserBlockRefresh(); - } catch (error) { + moderationService.awaitUserBlockRefresh().catch((error) => { const contextMessage = normalizedReason - ? ` before ${normalizedReason}` - : ""; + ? ` in background during ${normalizedReason}` + : " in background"; devLogger.warn( `Failed to sync moderation summaries${contextMessage}:`, error, ); - } + }); } try { @@ -5359,10 +5357,17 @@ class Application { devLogger.log("Starting loadVideos... (forceFetch =", forceFetch, ")"); const container = this.mountVideoListView(); - if (this.videoListView && container) { - this.videoListView.showLoading("Fetching recent videos…"); - } else if (container) { - container.innerHTML = getSidebarLoadingMarkup("Fetching recent videos…"); + const hasCachedVideos = + this.nostrService && + Array.isArray(this.nostrService.getFilteredActiveVideos()) && + this.nostrService.getFilteredActiveVideos().length > 0; + + if (!hasCachedVideos) { + if (this.videoListView && container) { + this.videoListView.showLoading("Fetching recent videos…"); + } else if (container) { + container.innerHTML = getSidebarLoadingMarkup("Fetching recent videos…"); + } } let initialRefreshPromise = null; diff --git a/js/nostr/client.js b/js/nostr/client.js index 31210d98..c7ab8ab3 100644 --- a/js/nostr/client.js +++ b/js/nostr/client.js @@ -5629,12 +5629,13 @@ export class NostrClient { getLatestCachedCreatedAt() { let latest = 0; + const now = Math.floor(Date.now() / 1000); for (const video of this.allEvents.values()) { const createdAt = Number.isFinite(video?.created_at) ? Math.floor(video.created_at) : 0; - if (createdAt > latest) { + if (createdAt > latest && createdAt <= now) { latest = createdAt; } }