From 467fcdfaab172253fc8244a48655bcbc5067bf15 Mon Sep 17 00:00:00 2001 From: Gandalf Date: Mon, 5 Jan 2026 23:40:04 +0100 Subject: [PATCH] Remove unnecessary SSR prefetch for user subscriptions The SSR prefetch for getSubscriptions(observer) was wasteful: - For non-logged-in users: Fetched hive.blog's subscriptions (DEFAULT_OBSERVER) which were never used since the client-side query is disabled - For logged-in users: Client fetches again anyway after hydration The subscriptions data is used for the "My Communities" sidebar which: - Is not SEO-critical (bots don't need personal subscriptions) - Is not above-the-fold critical (sidebar content) - Is personal data only relevant when logged in The client-side query in main-page-layout.tsx already handles this correctly: - Fetches only when user.isLoggedIn - Shows CommunitiesSidebar (generic list) as fallback This saves 1 API call per feed page for all users. Fixes #790 --- apps/blog/features/layouts/sorts/server-side-layout.tsx | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/apps/blog/features/layouts/sorts/server-side-layout.tsx b/apps/blog/features/layouts/sorts/server-side-layout.tsx index de26c63ea..4b5e2b8ae 100644 --- a/apps/blog/features/layouts/sorts/server-side-layout.tsx +++ b/apps/blog/features/layouts/sorts/server-side-layout.tsx @@ -1,7 +1,7 @@ import { getObserverFromCookies } from '@/blog/lib/auth-utils'; import { getQueryClient } from '@/blog/lib/react-query'; import { dehydrate, Hydrate } from '@tanstack/react-query'; -import { getCommunities, getSubscriptions } from '@transaction/lib/bridge-api'; +import { getCommunities } from '@transaction/lib/bridge-api'; import { ReactNode } from 'react'; import { getLogger } from '@ui/lib/logging'; @@ -18,10 +18,6 @@ const ServerSideLayout = async ({ children }: { children: ReactNode }) => { queryKey: ['communitiesList', sort], queryFn: () => getCommunities(sort, query, observer) }); - await queryClient.prefetchQuery({ - queryKey: ['subscriptions', observer], - queryFn: () => getSubscriptions(observer) - }); } catch (error) { logger.error(error, 'Error in ServerSideLayout:'); } -- GitLab