From 30b6610c266d58cd2819b96604f8a9f56933530c Mon Sep 17 00:00:00 2001 From: Bartosz Kaszubowski Date: Wed, 14 Jan 2026 14:29:52 +0100 Subject: [PATCH] fix disappearing home sections on som navigation paths and theme change --- pages/index.tsx | 5 +++-- scenes/TrendingScene.tsx | 4 ++-- util/urlWithQuery.ts | 2 +- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/pages/index.tsx b/pages/index.tsx index 55d31131e..eda99bd20 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -1,3 +1,4 @@ +import { cloneDeep } from 'es-toolkit/object'; import { type NextPageContext } from 'next'; import HomeScene from '~/scenes/HomeScene'; @@ -7,7 +8,7 @@ import getApiUrl from '~/util/getApiUrl'; import urlWithQuery from '~/util/urlWithQuery'; function Index(props: HomePageProps) { - return ; + return ; } const LIMIT = 8; @@ -56,7 +57,7 @@ Index.getInitialProps = async (ctx: NextPageContext) => { ); const statisticResponse = await fetch( - getApiUrl(urlWithQuery('/libraries/statistic', {}), ctx), + getApiUrl(urlWithQuery('/libraries/statistic'), ctx), NEXT_1H_CACHE_HEADER ); diff --git a/scenes/TrendingScene.tsx b/scenes/TrendingScene.tsx index 11cdea134..22e4c53c7 100644 --- a/scenes/TrendingScene.tsx +++ b/scenes/TrendingScene.tsx @@ -28,7 +28,7 @@ export default function TrendingScene({ data, query }: TrendingPageProps) { const total = data && data.total; function handleClearAllPress() { - void router.replace(urlWithQuery('/trending', {})); + void router.replace(urlWithQuery('/trending')); } return ( @@ -76,7 +76,7 @@ export default function TrendingScene({ data, query }: TrendingPageProps) {

Unfortunately that's all, what's trending now. Want to explore more libraries? Check out the{' '} - + directory home page . diff --git a/util/urlWithQuery.ts b/util/urlWithQuery.ts index c8ef5acd8..ea69c9f77 100644 --- a/util/urlWithQuery.ts +++ b/util/urlWithQuery.ts @@ -4,7 +4,7 @@ function toQueryString(query: Query) { return new URLSearchParams(query as Record).toString(); } -export default function urlWithQuery(url: string, query: Partial): string { +export default function urlWithQuery(url: string, query: Partial = {}): string { const queryString = toQueryString( Object.fromEntries(Object.entries(query).filter(([, v]) => Boolean(v))) );