From 1d56682a60f687ec933c5178503dff87b80613d6 Mon Sep 17 00:00:00 2001 From: Rakov Roman Date: Tue, 10 Jan 2023 11:27:56 +0300 Subject: [PATCH] fix(fix): fix duplicate request --- src/features/Matches/hooks.tsx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/features/Matches/hooks.tsx b/src/features/Matches/hooks.tsx index 95eb4d60..2235bb4e 100644 --- a/src/features/Matches/hooks.tsx +++ b/src/features/Matches/hooks.tsx @@ -13,8 +13,6 @@ import { useRequest } from 'hooks' import { usePreferencesStore } from 'features/PreferencesPopup' import { isMobileDevice } from 'config/userAgent' -import { checkUrlParams } from 'helpers/parseUrlParams/parseUrlParams' - import { prepareMatches } from './helpers/prepareMatches' export type Match = ReturnType[number] @@ -68,10 +66,10 @@ export const useMatches = ({ fetch }: Props) => { isFetching, ]) - const dateParam = checkUrlParams('date') - useEffect(() => { - if (dateParam) { + const isDefaultUrl = window.location.href.slice(0, -1) === window.location.origin + + if (!isDefaultUrl) { fetchMatches(0).then(setMatches) pageRef.current = 1 }