From a91bf4d56cb07e7f61a47c02eb42a38d8e926444 Mon Sep 17 00:00:00 2001 From: Silberengel Date: Sat, 14 Feb 2026 10:44:04 +0100 Subject: [PATCH] bug-fixes --- src/app.css | 4 +- .../components/content/FileExplorer.svelte | 36 +--- .../components/modals/EventJsonModal.svelte | 2 +- src/lib/modules/feed/FeedPost.svelte | 77 ++++++- src/lib/services/content/git-repo-fetcher.ts | 24 ++- src/routes/repos/+page.svelte | 200 ++++++++++++------ src/routes/repos/[naddr]/+page.svelte | 54 +++-- static/healthz.json | 4 +- vite.config.ts | 4 +- 9 files changed, 272 insertions(+), 133 deletions(-) diff --git a/src/app.css b/src/app.css index 403e2e1..1b0429a 100644 --- a/src/app.css +++ b/src/app.css @@ -1,6 +1,6 @@ -/* Custom highlight.js theme for code blocks, JSON previews, and markdown */ +/* highlight.js VS2015 theme for code blocks, JSON previews, and markdown */ /* @import must come before all other statements */ -@import './lib/styles/highlight-theme.css'; +@import 'highlight.js/styles/vs2015.css'; /* stylelint-disable-next-line at-rule-no-unknown */ @tailwind base; diff --git a/src/lib/components/content/FileExplorer.svelte b/src/lib/components/content/FileExplorer.svelte index 1657991..1d997c7 100644 --- a/src/lib/components/content/FileExplorer.svelte +++ b/src/lib/components/content/FileExplorer.svelte @@ -1,8 +1,10 @@ diff --git a/src/routes/repos/[naddr]/+page.svelte b/src/routes/repos/[naddr]/+page.svelte index 4676bfb..dd82ca4 100644 --- a/src/routes/repos/[naddr]/+page.svelte +++ b/src/routes/repos/[naddr]/+page.svelte @@ -33,6 +33,8 @@ let issues = $state([]); let issueComments = $state>(new Map()); let issueStatuses = $state>(new Map()); + let loadingIssues = $state(false); + let loadingIssueData = $state(false); // Statuses, comments, profiles let documentationEvents = $state>(new Map()); let changingStatus = $state>(new Map()); // Track which issues are having status changed let statusFilter = $state(null); // Filter issues by status: null = all, 'open', 'resolved', 'closed', 'draft' @@ -115,11 +117,9 @@ break; // Success, stop trying other URLs } } catch (error) { - // Failed to fetch git repo - // Continue to next URL + // Failed to fetch git repo - continue to next URL } } - } else { } } catch (error) { // Failed to load git repo @@ -279,6 +279,7 @@ async function loadIssues() { if (!repoEvent) return; + loadingIssues = true; try { const gitUrls = extractGitUrls(repoEvent); const relays = relayManager.getProfileReadRelays(); @@ -301,10 +302,16 @@ filters.push({ '#r': gitUrls, kinds: [KIND.ISSUE], limit: 100 }); } - // Batch fetch all issues in parallel + // Search for issues by the repo author (issues might be created by repo maintainers) + filters.push({ authors: [repoEvent.pubkey], kinds: [KIND.ISSUE], limit: 100 }); + + // Batch fetch all issues in parallel with cache-first strategy const issueEventsArrays = await Promise.all( filters.map(filter => - nostrClient.fetchEvents([filter], relays, { useCache: true, cacheResults: true }) + nostrClient.fetchEvents([filter], relays, { + useCache: 'cache-first', // Prioritize cache for faster loading + cacheResults: true + }) ) ); @@ -317,16 +324,24 @@ // Deduplicate and sort const uniqueIssues = Array.from(new Map(issueEvents.map(e => [e.id, e])).values()); issues = uniqueIssues.sort((a, b) => b.created_at - a.created_at); + loadingIssues = false; // Issues are loaded, show them immediately - - // Batch load statuses, comments, and profiles - await Promise.all([ + // Load statuses, comments, and profiles in background (don't wait) + // This allows the UI to show issues immediately + loadingIssueData = true; + Promise.all([ loadIssueStatuses(), loadIssueComments(), loadAllProfiles() - ]); + ]).finally(() => { + loadingIssueData = false; + }).catch(() => { + // Background loading errors are non-critical + loadingIssueData = false; + }); } catch (error) { // Failed to load issues + loadingIssues = false; } } @@ -346,7 +361,7 @@ limit: 200 }], relays, - { useCache: true, cacheResults: true } + { useCache: 'cache-first', cacheResults: true } // Prioritize cache ); @@ -551,10 +566,11 @@ const relays = relayManager.getCommentReadRelays(); // Batch fetch all comments for all issues + // Use cache-first to load comments faster const comments = await nostrClient.fetchEvents( [{ '#e': issueIds, kinds: [KIND.COMMENT], limit: 500 }], relays, - { useCache: true, cacheResults: true } + { useCache: 'cache-first', cacheResults: true } // Prioritize cache ); // Group comments by issue ID @@ -1287,7 +1303,11 @@ {:else if activeTab === 'issues'}
- {#if issues.length > 0} + {#if loadingIssues} +
+

Loading issues...

+
+ {:else if issues.length > 0}