diff --git a/src/feed/TimelineFeed.ts b/src/feed/TimelineFeed.ts index 6eeed1268..99b0b1a95 100644 --- a/src/feed/TimelineFeed.ts +++ b/src/feed/TimelineFeed.ts @@ -17,7 +17,7 @@ export default function useTimelineFeed(pubKeys: HexKey | Array, global: let sub = new Subscriptions(); sub.Id = `timeline:${subTab}`; - sub.Authors = new Set(global ? [] : pubKeys); + sub.Authors = global ? undefined : new Set(pubKeys); sub.Kinds = new Set([EventKind.TextNote, EventKind.Repost]); sub.Limit = 20; diff --git a/src/nostr/Subscriptions.ts b/src/nostr/Subscriptions.ts index 4bbece02e..bf6fd9ba2 100644 --- a/src/nostr/Subscriptions.ts +++ b/src/nostr/Subscriptions.ts @@ -15,42 +15,42 @@ export class Subscriptions { /** * a list of event ids or prefixes */ - Ids: Set | null + Ids?: Set /** * a list of pubkeys or prefixes, the pubkey of an event must be one of these */ - Authors: Set | null; + Authors?: Set; /** * a list of a kind numbers */ - Kinds: Set | null; + Kinds?: Set; /** * a list of event ids that are referenced in an "e" tag */ - ETags: Set | null; + ETags?: Set; /** * a list of pubkeys that are referenced in a "p" tag */ - PTags: Set | null; + PTags?: Set; /** * a timestamp, events must be newer than this to pass */ - Since: number | null; + Since?: number; /** * a timestamp, events must be older than this to pass */ - Until: number | null; + Until?: number; /** * maximum number of events to be returned in the initial query */ - Limit: number | null; + Limit?: number; /** * Handler function for this event @@ -79,14 +79,14 @@ export class Subscriptions { constructor(sub?: RawReqFilter) { this.Id = uuid(); - this.Ids = sub?.ids ? new Set(sub.ids) : null; - this.Authors = sub?.authors ? new Set(sub.authors) : null; - this.Kinds = sub?.kinds ? new Set(sub.kinds) : null; - this.ETags = sub?.["#e"] ? new Set(sub["#e"]) : null; - this.PTags = sub?.["#p"] ? new Set(sub["#p"]) : null; - this.Since = sub?.since ?? null; - this.Until = sub?.until ?? null; - this.Limit = sub?.limit ?? null; + this.Ids = sub?.ids ? new Set(sub.ids) : undefined; + this.Authors = sub?.authors ? new Set(sub.authors) : undefined; + this.Kinds = sub?.kinds ? new Set(sub.kinds) : undefined; + this.ETags = sub?.["#e"] ? new Set(sub["#e"]) : undefined; + this.PTags = sub?.["#p"] ? new Set(sub["#p"]) : undefined; + this.Since = sub?.since ?? undefined; + this.Until = sub?.until ?? undefined; + this.Limit = sub?.limit ?? undefined; this.OnEvent = (e) => { console.warn(`No event handler was set on subscription: ${this.Id}`) }; this.OnEnd = (c) => { }; this.OrSubs = [];