|
|
|
|
@ -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<typeof prepareMatches>[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(() => ({ |
|
|
|
|
|