Add AbortSignal's to things

This commit is contained in:
Alex Gleason committed 2025-04-23 15:13:17 -05:00
1 parent 99970309e2
commit 7d81db739c
4 files changed
+13 -17

No files matched your search

+3 -2
View File
@@ -106,8 +106,9 @@ function usePosts() {
return useQuery({
queryKey: ['posts'],
queryFn: async () => {
const events = await nostr.query([{ kinds: [1], limit: 20 }]);
queryFn: async (c) => {
const signal = AbortSignal.any([c.signal, AbortSignal.timeout(1500)]);
const events = await nostr.query([{ kinds: [1], limit: 20 }], { signal });
return events; // these events could be transformed into another format
},
});