Browse Source

Fix profile event counts to show from all events

- 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 <noreply@anthropic.com>
master
limina1 9 months ago
parent
commit
2d7f827c62
  1. 6
      src/lib/navigator/EventNetwork/index.svelte
  2. 12
      src/routes/visualize/+page.svelte

6
src/lib/navigator/EventNetwork/index.svelte

@ -75,7 +75,8 @@ @@ -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 @@ @@ -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 @@ @@ -1216,7 +1218,7 @@
{onclear}
{onFetchMissing}
bind:starVisualization
{eventCounts}
eventCounts={allEventCounts}
{profileStats}
/>

12
src/routes/visualize/+page.svelte

@ -64,6 +64,17 @@ @@ -64,6 +64,17 @@
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 @@ @@ -1038,6 +1049,7 @@
onTagExpansionChange={handleTagExpansion}
onFetchMissing={fetchMissingEvents}
{profileStats}
{allEventCounts}
/>
{/if}
</div>

Loading…
Cancel
Save