diff --git a/src/features/Matches/hooks.tsx b/src/features/Matches/hooks.tsx index 4f0bd402..95eb4d60 100644 --- a/src/features/Matches/hooks.tsx +++ b/src/features/Matches/hooks.tsx @@ -13,6 +13,8 @@ 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] @@ -66,13 +68,18 @@ export const useMatches = ({ fetch }: Props) => { isFetching, ]) + const dateParam = checkUrlParams('date') + useEffect(() => { - fetchMatches(0).then(setMatches) - pageRef.current = 1 + if (dateParam) { + fetchMatches(0).then(setMatches) + pageRef.current = 1 + } return () => { setMatches(initialState) } + // eslint-disable-next-line react-hooks/exhaustive-deps }, [fetchMatches, userPreferences]) const preparedMatches = useMemo(() => ({