From 354bceaac761c6bd46666abc7317fb6276cee34f Mon Sep 17 00:00:00 2001 From: Mirlan Date: Fri, 19 Nov 2021 13:20:32 +0600 Subject: [PATCH] fix(1964): reset match playlists on location change --- src/features/MatchPopup/store/hooks/index.tsx | 6 ++++++ 1 file changed, 6 insertions(+) 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,