aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdrien Hopkins <[email protected]>2025-10-02 10:45:55 -0500
committerAdrien Hopkins <[email protected]>2025-10-02 10:45:55 -0500
commitbb168314227f94db7457f541568c3386380acba5 (patch)
tree7382940868b803332db93ec919e14797d3cd3148 /src
parentd7c45ac379b317b0270f58e4366b2bec229213f2 (diff)
downloadcoinos-ui-bb168314227f94db7457f541568c3386380acba5.tar.gz
coinos-ui-bb168314227f94db7457f541568c3386380acba5.zip
Refresh messages after sending
Diffstat (limited to 'src')
-rw-r--r--src/routes/(app)/dm/[recipient]/+page.svelte20
1 files changed, 12 insertions, 8 deletions
diff --git a/src/routes/(app)/dm/[recipient]/+page.svelte b/src/routes/(app)/dm/[recipient]/+page.svelte
index f41f9a9f..9fed1aad 100644
--- a/src/routes/(app)/dm/[recipient]/+page.svelte
+++ b/src/routes/(app)/dm/[recipient]/+page.svelte
@@ -17,14 +17,17 @@
let text = $state("");
let events = $state([]);
- pool.querySync(DM_RELAYS_LIST,
- { kinds: [1059], "#p": [user.pubkey], limit: DM_FETCH_LIMIT })
- .then(wrapped =>
- Promise.all(wrapped.map(decryptMessage))
- .then(rumours => {
- events = rumours;
- events.sort((ev1, ev2) => ev1.created_at - ev2.created_at);
- }));
+ const loadEvents = () => {
+ const filter = { kinds: [1059], "#p": [user.pubkey], limit: DM_FETCH_LIMIT };
+ pool.querySync(DM_RELAYS_LIST, filter).then(wrapped =>
+ Promise.all(wrapped.map(decryptMessage))
+ .then(rumours => {
+ events = rumours;
+ events.sort((ev1, ev2) => ev1.created_at - ev2.created_at);
+ }));
+ }
+
+ loadEvents();
const btnCreateMessage = async () => {
let event1, event2;
@@ -43,6 +46,7 @@
const p1 = Promise.any(pool.publish(DM_RELAYS_LIST, event1));
const p2 = Promise.any(pool.publish(DM_RELAYS_LIST, event2));
await Promise.all([p1, p2]);
+ loadEvents();
}
const decryptMessage = async (event: object): object => {