From 281eace25eca14eadaf9637b4daf69b3ced088e3 Mon Sep 17 00:00:00 2001 From: Gandalf Date: Sat, 13 Dec 2025 22:40:09 +0100 Subject: [PATCH] Disable Link prefetch for profile and post pages Add prefetch={false} to Link components that navigate to profile pages (/@username) and post pages (/category/@author/permlink) to prevent excessive API calls. Next.js prefetches linked pages when they enter the viewport, triggering SSR which calls multiple APIs (profile data, reputation, Twitter info, etc). A single trending page with 20 posts was causing 140-180 API calls just from prefetching. This change reduces API load on decentralized Hive nodes and third-party services while maintaining full SEO compatibility (crawlers don't use prefetch). --- apps/blog/features/list-of-posts/post-list-item.tsx | 10 ++++++++-- apps/blog/features/list-of-posts/summary.tsx | 3 ++- apps/blog/features/post-rendering/user-info.tsx | 2 +- apps/blog/features/suggestions-posts/card.tsx | 4 ++-- 4 files changed, 13 insertions(+), 6 deletions(-) diff --git a/apps/blog/features/list-of-posts/post-list-item.tsx b/apps/blog/features/list-of-posts/post-list-item.tsx index 38e007a16..c8d06715d 100644 --- a/apps/blog/features/list-of-posts/post-list-item.tsx +++ b/apps/blog/features/list-of-posts/post-list-item.tsx @@ -65,6 +65,7 @@ const PostListItem = ({ {post.author} {' '} @@ -72,6 +73,7 @@ const PostListItem = ({ @{post.original_entry.author}/{post.original_entry.permlink} @@ -86,6 +88,7 @@ const PostListItem = ({ href={`/@${post.reblogged_by[0]}`} className="cursor-pointer hover:text-destructive" data-testid="reblogged-author-link" + prefetch={false} > {post.reblogged_by[0]} {' '} @@ -96,7 +99,7 @@ const PostListItem = ({
{nsfw === 'show' && post.blacklists.length < 1 ? ( - +
{post.author} {' '} @@ -157,6 +161,7 @@ const PostListItem = ({ href={`/${post.category}/@${post.author}/${post.permlink}`} className="hover:cursor-pointer hover:text-destructive" data-testid="post-card-timestamp" + prefetch={false} > @@ -165,7 +170,7 @@ const PostListItem = ({ - + @@ -181,6 +186,7 @@ const PostListItem = ({ {t('cards.badges.pinned')} diff --git a/apps/blog/features/list-of-posts/summary.tsx b/apps/blog/features/list-of-posts/summary.tsx index 12ba415e2..b7fbef06f 100644 --- a/apps/blog/features/list-of-posts/summary.tsx +++ b/apps/blog/features/list-of-posts/summary.tsx @@ -39,12 +39,13 @@ const PostSummary = ({ {post.title} - + {userFromDMCA ? t('cards.content_removed') : legalBlockedUser diff --git a/apps/blog/features/post-rendering/user-info.tsx b/apps/blog/features/post-rendering/user-info.tsx index 47ad5fcd2..a32d41185 100644 --- a/apps/blog/features/post-rendering/user-info.tsx +++ b/apps/blog/features/post-rendering/user-info.tsx @@ -92,7 +92,7 @@ function UserInfo({ {authored ? ( Authored by{' '} - + @{authored} diff --git a/apps/blog/features/suggestions-posts/card.tsx b/apps/blog/features/suggestions-posts/card.tsx index e4758d44a..8eb06df46 100644 --- a/apps/blog/features/suggestions-posts/card.tsx +++ b/apps/blog/features/suggestions-posts/card.tsx @@ -14,7 +14,7 @@ const SuggestionsCard = ({ entry }: { entry: Entry }) => { const [image, setImage] = useState(cardImage); return (
- + <> {image ? (
@@ -38,7 +38,7 @@ const SuggestionsCard = ({ entry }: { entry: Entry }) => {

{truncateTitle(entry.title)}

- {entry.author} + {entry.author}
-- GitLab