Skip to content

perf: speed up episode loading, profile pics, and lazy mount cards#56

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

perf: speed up episode loading, profile pics, and lazy mount cards#56
kurt-croix merged 1 commit into
mainfrom
fix/perf-episode-loading

Conversation

@kurt-croix

Copy link
Copy Markdown
Owner

Performance improvements

What was slow

  • Homepage latest episode: 8s+ (two sequential Nostr queries)
  • Profile pictures: refetched on every page navigation
  • Episodes page: all cards mount immediately, each fires a useComments() Nostr query

Changes

  1. useLatestEpisode — removed fetchLivestreamStarts query entirely (episodes now have pubdate tags). Reduced limit 20→10, timeout 8s→5s. ~5s faster.
  2. useInfiniteEpisodes — same livestream starts removal, timeout 8s→5s, staleTime 1min→3min
  3. useAuthor — added staleTime: 5min + gcTime: 30min so profile pictures don't refetch on navigation
  4. useComments — accept optional root parameter, enabling deferred fetching
  5. EpisodeCardReact.memo + loading=lazy on images + defer useComments() until user toggles comments section open
  6. EpisodeListLazyEpisodeCard wrapper uses IntersectionObserver to mount cards only when scrolled into view. Shows skeleton placeholder until visible.

- useLatestEpisode: remove livestream starts query (episodes have
  pubdate tags now), reduce limit 20→10, timeout 8s→5s, staleTime 3min
- useInfiniteEpisodes: remove livestream starts query, timeout 8s→5s,
  staleTime 3min
- useAuthor: add staleTime 5min + gcTime 30min for profile caching
- useComments: accept optional root to enable deferred fetching
- EpisodeCard: React.memo, lazy image loading, defer useComments
  until comments section is toggled
- EpisodeList: LazyEpisodeCard wrapper with IntersectionObserver
  for progressive mounting as cards scroll into view
@kurt-croix
kurt-croix merged commit 31814e6 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