Skip to content

fix: preserve episode created_at ordering + increase query limit#54

Merged
kurt-croix merged 1 commit into
mainfrom
fix/episode-visibility
May 12, 2026
Merged

fix: preserve episode created_at ordering + increase query limit#54
kurt-croix merged 1 commit into
mainfrom
fix/episode-visibility

Conversation

@kurt-croix

Copy link
Copy Markdown
Owner

Problem

Episodes page shows incomplete results — May 6 episode missing despite showing on homepage.

Root Cause

The sync script (sync-episodes-to-relays.ts) bumped all episode created_at timestamps to now():

created_at: Math.max(mostComplete.created_at + 1, Math.floor(Date.now() / 1000))

This made all 23 episodes share the same timestamp. Relays return only 15 events per query (the limit), so with identical timestamps the relay picks arbitrarily — real episodes get randomly excluded.

Changes

  1. scripts/sync-episodes-to-relays.ts: Use created_at + 1 instead of max(created_at + 1, now()) to preserve original chronological ordering
  2. src/hooks/usePodcastEpisodes.ts: Increase infinite scroll fetch limit to Math.max(limit + 5, 50) to fetch all episodes even when many hidden/test episodes exist
  3. src/hooks/usePodcastEpisodes.ts: Replace any types with proper NostrFilter type

Root cause: sync script bumped all episode created_at to now(), making
all 23 episodes share the same timestamp. Relays return only 15 events
per query, so real episodes got randomly excluded.

Changes:
- sync-episodes-to-relays.ts: use original_created_at + 1 instead of
  max(original+1, now()) to preserve chronological ordering
- usePodcastEpisodes.ts: increase infinite scroll query limit to
  Math.max(limit+5, 50) to fetch all episodes including hidden ones
- usePodcastEpisodes.ts: replace any types with proper NostrFilter type
@kurt-croix
kurt-croix merged commit 26d2e2f into main May 12, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants