Fix unnecessary community API calls and improve Link performance
Summary
This MR contains performance improvements for the Denser application:
1. Skip community API calls for non-community tags (Fixes #768 (closed))
When navigating to posts or pages with regular tags (e.g., /test/@user/post or /created/test), the app was unnecessarily calling get_community API which would fail because regular tags are not communities. Communities in Hive always start with the hive- prefix.
Changes:
-
sort-page.tsx: Wrapped community-related prefetch queries (getCommunity,getSubscribers,getAccountNotifications) in atag.startsWith('hive-')check -
get-metadata.ts: Addedhive-prefix check ingetCommunityMetadata()to skip API calls for regular tags -
page.tsx: Fixed query key inconsistency from['communityData', community]to['community', community]for proper cache sharing
2. Add global Link wrapper with prefetch disabled by default
Created a custom Link component that wraps Next.js Link with prefetch={false} by default to reduce unnecessary network requests and improve initial page load performance.
Test plan
-
Navigate to /created/test- should NOT callget_communityAPI -
Navigate to /test/@guest4test1/6cmabj-test-template- should NOT callget_communityAPI -
Navigate to /hive-123456/@user/post- SHOULD callget_communityAPI -
Verify no console errors related to community API calls for regular tags -
Verify Link components work correctly without prefetching by default