From 3c84563e1afe3dabd6b0c41714f26101db061357 Mon Sep 17 00:00:00 2001 From: "@s.roertgen" Date: Wed, 30 Apr 2025 09:56:03 +0200 Subject: [PATCH] fix reaction counter --- src/lib/components/Comment.svelte | 17 +++++++---------- 1 file changed, 7 insertions(+), 10 deletions(-) diff --git a/src/lib/components/Comment.svelte b/src/lib/components/Comment.svelte index 74789e0..8eafdcb 100644 --- a/src/lib/components/Comment.svelte +++ b/src/lib/components/Comment.svelte @@ -16,24 +16,21 @@ tags: [['e', event.id]] }); await reactionEvent.publish(); + const r = await $ndk.fetchEvents({kinds: [7], "#e": [event.id]}) + console.log("r", r) + $reactions = Array.from(r); } - onMount(() => { + onMount(async () => { if (!$user) { console.log('no user, logging in'); login(); } + const r = await $ndk.fetchEvents({kinds: [7], "#e": [event.id]}) + console.log("r", r) + $reactions = Array.from(r); }); - $effect(() => { - if ($ndkReady) { - const sub = $ndk.subscribe({ kinds: [7], '#e': [event.id] }); - sub.on('event', (e) => { - $reactions = [...$reactions, e]; - console.log(`${e.content}`); - }); - } - });