Add abort to thunk

This commit is contained in:
Jon Staab
2024-10-16 12:07:57 -07:00
parent ac3c2e7d0b
commit f7e570d868
5 changed files with 66 additions and 14 deletions
+2 -4
View File
@@ -1,11 +1,11 @@
import {partition} from "@welshman/lib"
import {defaultOptimizeSubscriptions, getDefaultNetContext as originalGetDefaultNetContext} from "@welshman/net"
import type {Subscription, RelaysAndFilters, NetContext} from "@welshman/net"
import {WRAP, unionFilters, isSignedEvent, hasValidSignature} from "@welshman/util"
import {WRAP, unionFilters} from "@welshman/util"
import type {TrustedEvent, StampedEvent} from "@welshman/util"
import {tracker, repository} from './core'
import {makeRouter, getFilterSelections} from './router'
import {getSession, signer} from './session'
import {signer} from './session'
import type {Router} from './router'
import {loadProfile} from './profiles'
@@ -31,8 +31,6 @@ export const getDefaultNetContext = (overrides: Partial<NetContext> = {}) => ({
}
},
isDeleted: (url: string, event: TrustedEvent) => repository.isDeleted(event),
isValid: (url: string, event: TrustedEvent) =>
getSession(event.pubkey) || (isSignedEvent(event) && hasValidSignature(event)),
optimizeSubscriptions: (subs: Subscription[]) => {
const [withRelays, withoutRelays] = partition(sub => sub.request.relays.length > 0, subs)
const filters = unionFilters(withoutRelays.flatMap(sub => sub.request.filters))