fix(#2789): fix fullgame duration for switch playlists

keep-around/b214ac7012ef42593bee62c207888a2593bc5a38
Andrei Dekterev 3 years ago
parent 1f5d372f55
commit 0fd427bbe7
  1. 15
      src/features/MatchPage/store/hooks/useMatchData.tsx

@ -1,4 +1,8 @@
import { useEffect, useMemo } from 'react'
import {
useEffect,
useMemo,
useState,
} from 'react'
import debounce from 'lodash/debounce'
@ -19,6 +23,7 @@ const MATCH_PLAYLISTS_DELAY = 5000
export const useMatchData = (profile: MatchInfo) => {
const { profileId: matchId, sportType } = usePageParams()
const { chapters } = useMatchPopupStore()
const [matchDuration, setMatchDuration] = useState(0)
const {
fetchMatchPlaylists,
handlePlaylistClick,
@ -32,7 +37,8 @@ export const useMatchData = (profile: MatchInfo) => {
() => debounce(fetchMatchPlaylists, MATCH_PLAYLISTS_DELAY),
[fetchMatchPlaylists],
)
const fullMatchDuration = useDuration(chapters) / 1000
const chaptersDuration = useDuration(chapters) / 1000
const fullMatchDuration = matchDuration
useEffect(() => {
if (!profile) return
fetchMatchPlaylists({
@ -73,6 +79,11 @@ export const useMatchData = (profile: MatchInfo) => {
}
}, [profile?.live, start, stop])
useEffect(() => {
selectedPlaylist?.id === 'full_game' && setMatchDuration(chaptersDuration)
// eslint-disable-next-line
}, [profile, chaptersDuration])
return {
events,
handlePlaylistClick,

Loading…
Cancel
Save