Browse Source

bug-fixes

master
Silberengel 1 month ago
parent
commit
631285fed2
  1. 4
      public/healthz.json
  2. 60
      src/lib/components/profile/EditProfileEventsPanel.svelte
  3. 7
      src/lib/components/write/CreateEventForm.svelte

4
public/healthz.json

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
"status": "ok",
"service": "aitherboard",
"version": "0.3.0",
"buildTime": "2026-02-11T10:31:42.382Z",
"buildTime": "2026-02-11T10:52:47.456Z",
"gitCommit": "unknown",
"timestamp": 1770805902382
"timestamp": 1770807167456
}

60
src/lib/components/profile/EditProfileEventsPanel.svelte

@ -2,7 +2,7 @@ @@ -2,7 +2,7 @@
import { goto } from '$app/navigation';
import { nostrClient } from '../../services/nostr/nostr-client.js';
import { relayManager } from '../../services/nostr/relay-manager.js';
import { isParameterizedReplaceableKind } from '../../types/kind-lookup.js';
import { isParameterizedReplaceableKind, isReplaceableKind } from '../../types/kind-lookup.js';
import type { NostrEvent } from '../../types/nostr.js';
interface Props {
@ -48,9 +48,61 @@ @@ -48,9 +48,61 @@
loadingKinds = new Set();
loadedKinds = new Set();
// Load events for all kinds in parallel
const loadPromises = PROFILE_EVENT_KINDS.map(({ kind }) => loadEventForKind(kind));
await Promise.all(loadPromises);
// Separate replaceable kinds from parameterized replaceable kinds
const replaceableKinds = PROFILE_EVENT_KINDS
.map(({ kind }) => kind)
.filter(isReplaceableKind);
const parameterizedKinds = PROFILE_EVENT_KINDS
.map(({ kind }) => kind)
.filter(isParameterizedReplaceableKind);
// Mark all kinds as loading
const allKinds = [...replaceableKinds, ...parameterizedKinds];
loadingKinds = new Set(allKinds);
try {
const relays = relayManager.getProfileReadRelays();
// Single fetch for all replaceable kinds
if (replaceableKinds.length > 0) {
const events = await nostrClient.fetchEvents(
[{ kinds: replaceableKinds, authors: [pubkey], limit: replaceableKinds.length }],
relays,
{ useCache: true, cacheResults: true }
);
// Group events by kind and get the newest for each kind
const eventsByKind = new Map<number, NostrEvent[]>();
for (const event of events) {
if (!eventsByKind.has(event.kind)) {
eventsByKind.set(event.kind, []);
}
eventsByKind.get(event.kind)!.push(event);
}
// Get newest event for each kind
const newMap = new Map(eventMap);
for (const kind of replaceableKinds) {
const kindEvents = eventsByKind.get(kind) || [];
if (kindEvents.length > 0) {
const newest = kindEvents.sort((a, b) => b.created_at - a.created_at)[0];
newMap.set(kind, newest);
}
}
eventMap = newMap;
}
// Load parameterized replaceable kinds separately (they need d-tag handling)
const parameterizedPromises = parameterizedKinds.map(kind => loadEventForKind(kind));
await Promise.all(parameterizedPromises);
} catch (error) {
console.error('Error loading profile events:', error);
} finally {
// Mark all kinds as loaded
loadedKinds = new Set(allKinds);
loadingKinds = new Set();
}
}
async function loadEventForKind(kind: number) {

7
src/lib/components/write/CreateEventForm.svelte

@ -13,7 +13,7 @@ @@ -13,7 +13,7 @@
import AdvancedEditor from './AdvancedEditor.svelte';
import { shouldIncludeClientTag } from '../../services/client-tag-preference.js';
import { goto } from '$app/navigation';
import { KIND } from '../../types/kind-lookup.js';
import { KIND, KIND_LOOKUP } from '../../types/kind-lookup.js';
import { getKindMetadata, getWritableKinds } from '../../types/kind-metadata.js';
import type { NostrEvent } from '../../types/nostr.js';
import { autoExtractTags, ensureDTagForParameterizedReplaceable } from '../../services/auto-tagging.js';
@ -527,6 +527,11 @@ @@ -527,6 +527,11 @@
{#each SUPPORTED_KINDS as kind}
<option value={kind.value}>{kind.label}</option>
{/each}
{#if selectedKind !== -1 && !SUPPORTED_KINDS.find(k => k.value === selectedKind)}
{@const kindInfo = getKindMetadata(selectedKind)}
{@const kindDescription = kindInfo?.description || KIND_LOOKUP[selectedKind]?.description || 'Unknown'}
<option value={selectedKind}>{selectedKind} - {kindDescription}</option>
{/if}
</select>
{#if isUnknownKind}
<div class="custom-kind-input">

Loading…
Cancel
Save