diff --git a/src/features/MatchPopup/store/hooks/index.tsx b/src/features/MatchPopup/store/hooks/index.tsx index 4ceb7cda..c37262bb 100644 --- a/src/features/MatchPopup/store/hooks/index.tsx +++ b/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(null) const [matchPlaylists, setMatchPlaylists] = useState(initialPlaylists) @@ -81,6 +83,10 @@ export const useMatchPopup = () => { setSelectedPlaylistFormat, ]) + useEffect(() => { + setMatchPlaylists(initialPlaylists) + }, [pathname]) + const fetchMatchPlaylists = useCallback(({ id, sportType,