1dfe209690ce30180d97068c145f5dd61821ea35
Previously the feed had two separate systems (batch hooks in Feed.tsx + individual hooks in NoteCard) that raced each other. The batch ran as a useQuery at the component level, but NoteCards mounted in the same render cycle and fired their own per-card queries before the batch resolved. This got worse with each page as both systems scaled up. The fix: prefetch authors and stats *inside* useFeed's queryFn, after the feed events are fetched but before the queryFn returns. By the time React re-renders with the new page data, the ['author', pubkey] and ['event-stats', id] caches are already populated. NoteCard's individual useAuthor and useEventStats hooks then resolve instantly from cache without firing any extra network requests. New page loads only fetch authors/stats for IDs not already in cache, so page 1's data is never re-requested when page 2 loads. - Remove useAuthors + useBatchEventStats calls from Feed.tsx entirely - Export computePageStats from useTrending for use in useFeed - useBatchEventStats / useAuthors still exist for non-feed use cases Co-authored-by: shakespeare.diy <assistant@shakespeare.diy>
Description
Languages
TypeScript
95.7%
Java
1.5%
JavaScript
0.9%
Swift
0.9%
CSS
0.5%
Other
0.4%