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)))
);