fix(1964): reset match playlists on location change

keep-around/354bceaac761c6bd46666abc7317fb6276cee34f
Mirlan 4 years ago
parent 6b385ddc95
commit 354bceaac7
  1. 6
      src/features/MatchPopup/store/hooks/index.tsx

@ -3,6 +3,7 @@ import {
useEffect,
useCallback,
} from 'react'
import { useLocation } from 'react-router-dom'
import isEmpty from 'lodash/isEmpty'
@ -32,6 +33,7 @@ type ArgsFetchMatchPlaylists = {
const initialPlaylists = buildPlaylists(null)
export const useMatchPopup = () => {
const { pathname } = useLocation()
const [match, setMatch] = useState<MatchData>(null)
const [matchPlaylists, setMatchPlaylists] = useState<Playlists>(initialPlaylists)
@ -81,6 +83,10 @@ export const useMatchPopup = () => {
setSelectedPlaylistFormat,
])
useEffect(() => {
setMatchPlaylists(initialPlaylists)
}, [pathname])
const fetchMatchPlaylists = useCallback(({
id,
sportType,

Loading…
Cancel
Save