Remove duplicate community data prefetching in layout and page components

Problem

Community pages (/trending/hive-123, /hot/hive-123, etc.) make duplicate API calls because both the layout wrapper and page component prefetch the same data with identical query keys.

Root Cause

Layout (features/layouts/community/prefetch-component.tsx:29-42):

if (isCommunity(tag)) {
  await queryClient.prefetchQuery({
    queryKey: ['community', community],
    queryFn: () => getCommunity(community, observer)
  });
  await queryClient.prefetchQuery({
    queryKey: ['subscribers', community],
    queryFn: () => getSubscribers(community)
  });
  await queryClient.prefetchQuery({
    queryKey: ['AccountNotification', community],
    queryFn: () => getAccountNotifications(community)
  });
}

Page (features/community-profile/sort-page.tsx:31-42):

if (isCommunity(tag)) {
  await queryClient.prefetchQuery({
    queryKey: ['community', community],  // DUPLICATE
    queryFn: () => getCommunity(community, observer)
  });
  await queryClient.prefetchQuery({
    queryKey: ['subscribers', community],  // DUPLICATE
    queryFn: () => getSubscribers(community)
  });
  await queryClient.prefetchQuery({
    queryKey: ['AccountNotification', community],  // DUPLICATE
    queryFn: () => getAccountNotifications(community)
  });
}

Impact

  • 3 potentially duplicate API calls per community page visit:
    • bridge.get_community
    • bridge.list_subscribers
    • bridge.account_notifications
  • React Query may deduplicate via query key, but:
    • Initial fetch before caching still happens
    • Code duplication is confusing and error-prone
  • list_subscribers and account_notifications aren't needed for SSR (sidebar/tab content, not above-the-fold)

Comparison with Condenser

Condenser makes 3-4 SSR calls for community pages:

  • bridge.get_ranked_posts
  • bridge.get_community
  • condenser_api.get_feed_history
  • condenser_api.get_dynamic_global_properties

Denser makes 5-7 calls (before deduplication), fetching subscriber and notification data that isn't critical for initial render.

Proposed Fix

  1. Consolidate prefetches to one location - either layout OR page, not both
  2. Remove non-critical SSR prefetches:
    • getSubscribers() - sidebar detail, not critical for initial render
    • getAccountNotifications() - tab content, not initial view
  3. Keep only getCommunity() in SSR - needed for page metadata (title, OG tags)

In prefetch-component.tsx:

if (isCommunity(tag)) {
  // Only prefetch what's needed for page metadata and initial render
  await queryClient.prefetchQuery({
    queryKey: ['community', community],
    queryFn: () => getCommunity(community, observer)
  });
  // Remove getSubscribers and getAccountNotifications - let client fetch
}

In sort-page.tsx: Remove duplicate community prefetches entirely - layout handles it.

  • #790 (closed) - Remove unnecessary SSR prefetch for user subscriptions
  • #764 - Current API calls are sub-optimal for denser needs
  • NOTES/05-api-call-comparison-results.md - Full API comparison analysis