Fix DMs not loading — use subscribe instead of fetchEvents for gift wraps

NDK's fetchEvents silently returns 0 results for kind 1059 (gift wrap)
events despite relays having them. Replaced with manual subscribe +
eose listener which correctly receives the events.
This commit is contained in:
Jure
2026-04-06 11:49:34 +02:00
parent e99a2e880f
commit 111473ddb4
2 changed files with 41 additions and 24 deletions
+4
View File
@@ -155,13 +155,17 @@ function ThreadPanel({
setSending(true);
setSendError(null);
try {
console.log("[DM-UI] sending to", partnerPubkey.slice(0, 8));
await sendDM(partnerPubkey, content);
console.log("[DM-UI] send completed, re-fetching thread...");
setText("");
// Re-fetch thread to include the sent message
const updated = await fetchDMThread(myPubkey, partnerPubkey);
console.log("[DM-UI] re-fetch got", updated.length, "messages");
setMessages(updated);
textareaRef.current?.focus();
} catch (err) {
console.error("[DM-UI] send failed:", err);
setSendError(String(err));
} finally {
setSending(false);