From e3a58637a7540ea717ea75859c91faeaa1d111a1 Mon Sep 17 00:00:00 2001 From: Bojan Mojsilovic Date: Mon, 15 Apr 2024 16:21:41 +0200 Subject: [PATCH] Fix DMs --- src/components/Lnbc/Lnbc.tsx | 4 ++-- src/contexts/MessagesContext.tsx | 5 +++-- src/lib/localStore.ts | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/src/components/Lnbc/Lnbc.tsx b/src/components/Lnbc/Lnbc.tsx index 54a40aa..a5c303c 100644 --- a/src/components/Lnbc/Lnbc.tsx +++ b/src/components/Lnbc/Lnbc.tsx @@ -74,10 +74,10 @@ const Lnbc: Component< { } const amount = () => - `${humanizeNumber(parseInt(invoice.sections.find(s => s.name === 'amount')?.value ||'0') / 1_000)} sats`; + `${humanizeNumber(parseInt(invoice.sections.find(s => s.name === 'amount')?.value || '0') / 1_000)} sats`; const description = () => - decodeURI(invoice.sections.find(s => s.name === 'description')?.value); + decodeURI(invoice.sections.find(s => s.name === 'description')?.value) || ''; const confirmPayment = () => app?.actions.openConfirmModal({ title: intl.formatMessage(lnInvoice.confirm.title), diff --git a/src/contexts/MessagesContext.tsx b/src/contexts/MessagesContext.tsx index 46051ab..5d5e8b4 100644 --- a/src/contexts/MessagesContext.tsx +++ b/src/contexts/MessagesContext.tsx @@ -182,14 +182,15 @@ export const MessagesProvider = (props: { children: ContextChildren }) => { batch(() => { // @ts-ignore - updateStore('senders', () => undefined); + // updateStore('senders', () => undefined); // @ts-ignore - updateStore('messageCountPerSender', () => undefined); + // updateStore('messageCountPerSender', () => undefined); updateStore('senders', () => ({ ...senders})); updateStore('messageCountPerSender', () => ({ ...counts })); }) + // @ts-ignore getMessageCounts(account.publicKey, store.senderRelation, subidMsgCountPerSender); } diff --git a/src/lib/localStore.ts b/src/lib/localStore.ts index 9864f97..a7de187 100644 --- a/src/lib/localStore.ts +++ b/src/lib/localStore.ts @@ -423,8 +423,8 @@ export const saveDmConversations = (pubkey: string | undefined, contacts: Record store.dmConversations = { profiles: {}, counts: {} }; } - store.dmConversations.profiles = { ...contacts }; - store.dmConversations.counts = { ...counts }; + store.dmConversations.profiles = { ...store.dmConversations.profiles, ...contacts }; + store.dmConversations.counts = { ...store.dmConversations.counts, ...counts }; setStorage(pubkey, store); }