Remove AbortSignal.any calls

This commit is contained in:
Alex Gleason committed 2026-02-21 13:57:43 -06:00
1 parent 12dcbfdb33
commit 157ecac58b
5 files changed
+10 -10

No files matched your search

@@ -16,12 +16,12 @@ export function useGlobalFeed() {
return useInfiniteQuery({
queryKey: ['global-feed'],
queryFn: async ({ pageParam, signal }) => {
queryFn: async ({ pageParam }) => {
const filter = { kinds: [1], limit: 20 };
if (pageParam) filter.until = pageParam;
const events = await nostr.query([filter], {
signal: AbortSignal.any([signal, AbortSignal.timeout(1500)])
signal: AbortSignal.timeout(1500),
});
return events;
+2 -2
View File
@@ -7,14 +7,14 @@ export function useAuthor(pubkey: string | undefined) {
return useQuery<{ event?: NostrEvent; metadata?: NostrMetadata }>({
queryKey: ['nostr', 'author', pubkey ?? ''],
queryFn: async ({ signal }) => {
queryFn: async () => {
if (!pubkey) {
return {};
}
const [event] = await nostr.query(
[{ kinds: [0], authors: [pubkey!], limit: 1 }],
{ signal: AbortSignal.any([signal, AbortSignal.timeout(1500)]) },
{ signal: AbortSignal.timeout(1500) },
);
if (!event) {
+2 -2
View File
@@ -7,7 +7,7 @@ export function useComments(root: NostrEvent | URL, limit?: number) {
return useQuery({
queryKey: ['nostr', 'comments', root instanceof URL ? root.toString() : root.id, limit],
queryFn: async (c) => {
queryFn: async () => {
const filter: NostrFilter = { kinds: [1111] };
if (root instanceof URL) {
@@ -26,7 +26,7 @@ export function useComments(root: NostrEvent | URL, limit?: number) {
}
// Query for all kind 1111 comments that reference this addressable event regardless of depth
const signal = AbortSignal.any([c.signal, AbortSignal.timeout(5000)]);
const signal = AbortSignal.timeout(5000);
const events = await nostr.query([filter], { signal });
// Helper function to get tag value
+2 -2
View File
@@ -16,10 +16,10 @@ export function useLoggedInAccounts() {
const { data: authors = [] } = useQuery({
queryKey: ['nostr', 'logins', logins.map((l) => l.id).join(';')],
queryFn: async ({ signal }) => {
queryFn: async () => {
const events = await nostr.query(
[{ kinds: [0], authors: logins.map((l) => l.pubkey) }],
{ signal: AbortSignal.any([signal, AbortSignal.timeout(1500)]) },
{ signal: AbortSignal.timeout(1500) },
);
return logins.map(({ id, pubkey }): Account => {
+2 -2
View File
@@ -47,10 +47,10 @@ export function useZaps(
// Only refetch if the query is currently being observed (component is mounted)
return query.getObserversCount() > 0 ? 60000 : false;
},
queryFn: async (c) => {
queryFn: async () => {
if (!actualTarget) return [];
const signal = AbortSignal.any([c.signal, AbortSignal.timeout(5000)]);
const signal = AbortSignal.timeout(5000);
// Query for zap receipts for this specific event
if (actualTarget.kind >= 30000 && actualTarget.kind < 40000) {