From fcf8080eb95896257ceb89cd0588b8fa598cc4f4 Mon Sep 17 00:00:00 2001 From: Abdurrahman Rajab Date: Tue, 28 Nov 2023 00:23:18 +0300 Subject: [PATCH] fix: fix broken URL when you are using Range filter (#2204) --- layouts/filter.tsx | 2 +- layouts/hub-page.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/layouts/filter.tsx b/layouts/filter.tsx index c89b4dfd71..e7a43567fb 100644 --- a/layouts/filter.tsx +++ b/layouts/filter.tsx @@ -16,7 +16,7 @@ const FilterLayout = ({ children }: { children: React.ReactNode }) => { const { range } = router.query; useEffect(() => { - if (!range) { + if (router.isReady && !range) { setQueryParams({ range: "30" }); } }, [range, router.isReady]); diff --git a/layouts/hub-page.tsx b/layouts/hub-page.tsx index 0bc12a80d4..dc1e77fac7 100644 --- a/layouts/hub-page.tsx +++ b/layouts/hub-page.tsx @@ -22,7 +22,7 @@ const HubPageLayout = ({ children }: { children: React.ReactNode }) => { const repositories = insight?.repos.map((repo) => repo.repo_id); useEffect(() => { - if (!range) { + if (router.isReady && !range) { setQueryParams({ range: "30" }); } }, [range, router.isReady]);