Skip to content

Redundant and broken NDK filters in event fetch #5

@attixyz

Description

@attixyz

In two files, the event fetch uses three NDK filters, two of which are either broken or redundant.

Bug: filter 1 always returns zero events

{ kinds: [31922, 31923], since: now, until: sixMonthsFromNow, limit: 1000 }

since/until in NDK REQ filters target the Nostr created_at field (when the event was published), not the NIP-52 start tag. Since no event is published in the future, since: now always returns an empty set. This filter is a no-op.

Affected files:

  • src/components/common/events/UpcomingEventsSection.tsx
  • src/utils/nostr/eventCacheUtils.ts

Redundancy: filter 2 is a subset of filter 3 (eventCacheUtils.ts only)

{ kinds: [31922, 31923], since: now - 7 * 24 * 3600, limit: 500 }          // filter 2: last 7 days
{ kinds: [31922, 31923], since: now - 30 * 24 * 3600, until: now, limit: 300 }  // filter 3: last 30 days

The last 7 days is entirely within the last 30 days. Filter 2 adds a separate relay round-trip for results already covered by filter 3. The only difference is the higher limit (500 vs 300); the fix is to raise filter 3's limit, not keep both.


Proposed fix

In UpcomingEventsSection.tsx: delete filter 1, keep only filter 2 (since: now - 7 days).

In eventCacheUtils.ts: delete filters 1 and 2, keep only filter 3 with an increased limit (since: now - 30 days, until: now, limit: 500).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions