From 2d7f827c6250709955dd9e3181c0a1cab7e4ee9e Mon Sep 17 00:00:00 2001 From: limina1 Date: Tue, 17 Jun 2025 17:41:47 -0400 Subject: [PATCH] Fix profile event counts to show from all events MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Add allEventCounts derived from allEvents (not filtered events) - Pass allEventCounts through components to show true fetch status - This ensures kind 0 shows as green when profiles are fetched The issue was that event counts were derived from filtered events, so if kind 0 was disabled, it would show as 0 even if profiles were fetched. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/lib/navigator/EventNetwork/index.svelte | 6 ++++-- src/routes/visualize/+page.svelte | 12 ++++++++++++ 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/lib/navigator/EventNetwork/index.svelte b/src/lib/navigator/EventNetwork/index.svelte index 099ba6f..8c91334 100644 --- a/src/lib/navigator/EventNetwork/index.svelte +++ b/src/lib/navigator/EventNetwork/index.svelte @@ -75,7 +75,8 @@ onclear = () => {}, onTagExpansionChange, onFetchMissing = () => {}, - profileStats = { totalFetched: 0, displayLimit: 50 } + profileStats = { totalFetched: 0, displayLimit: 50 }, + allEventCounts = {} } = $props<{ events?: NDKEvent[]; followListEvents?: NDKEvent[]; @@ -85,6 +86,7 @@ onTagExpansionChange?: (depth: number, tags: string[]) => void; onFetchMissing?: (ids: string[]) => void; profileStats?: { totalFetched: number; displayLimit: number }; + allEventCounts?: { [kind: number]: number }; }>(); // Error state @@ -1216,7 +1218,7 @@ {onclear} {onFetchMissing} bind:starVisualization - {eventCounts} + eventCounts={allEventCounts} {profileStats} /> diff --git a/src/routes/visualize/+page.svelte b/src/routes/visualize/+page.svelte index 9ceaba9..cad8ef8 100644 --- a/src/routes/visualize/+page.svelte +++ b/src/routes/visualize/+page.svelte @@ -63,6 +63,17 @@ totalFetched: 0, displayLimit: 50 }); + + // Event counts from all events (not just filtered) + let allEventCounts = $derived.by(() => { + const counts: { [kind: number]: number } = {}; + allEvents.forEach((event: NDKEvent) => { + if (event.kind !== undefined) { + counts[event.kind] = (counts[event.kind] || 0) + 1; + } + }); + return counts; + }); /** * Fetches follow lists (kind 3) with depth expansion @@ -1038,6 +1049,7 @@ onTagExpansionChange={handleTagExpansion} onFetchMissing={fetchMissingEvents} {profileStats} + {allEventCounts} /> {/if}