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 @@
onclear = () => {}, onclear = () => {},
onTagExpansionChange, onTagExpansionChange,
onFetchMissing = () => {}, onFetchMissing = () => {},
profileStats = { totalFetched: 0, displayLimit: 50 } profileStats = { totalFetched: 0, displayLimit: 50 },
allEventCounts = {}
} = $props<{ } = $props<{
events?: NDKEvent[]; events?: NDKEvent[];
followListEvents?: NDKEvent[]; followListEvents?: NDKEvent[];
@ -85,6 +86,7 @@
onTagExpansionChange?: (depth: number, tags: string[]) => void; onTagExpansionChange?: (depth: number, tags: string[]) => void;
onFetchMissing?: (ids: string[]) => void; onFetchMissing?: (ids: string[]) => void;
profileStats?: { totalFetched: number; displayLimit: number }; profileStats?: { totalFetched: number; displayLimit: number };
allEventCounts?: { [kind: number]: number };
}>(); }>();
// Error state // Error state
@ -1216,7 +1218,7 @@
{onclear} {onclear}
{onFetchMissing} {onFetchMissing}
bind:starVisualization bind:starVisualization
{eventCounts} eventCounts={allEventCounts}
{profileStats} {profileStats}
/> />

12
src/routes/visualize/+page.svelte

@ -63,6 +63,17 @@
totalFetched: 0, totalFetched: 0,
displayLimit: 50 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 * Fetches follow lists (kind 3) with depth expansion
@ -1038,6 +1049,7 @@
onTagExpansionChange={handleTagExpansion} onTagExpansionChange={handleTagExpansion}
onFetchMissing={fetchMissingEvents} onFetchMissing={fetchMissingEvents}
{profileStats} {profileStats}
{allEventCounts}
/> />
{/if} {/if}
</div> </div>

Loading…
Cancel
Save