diff --git a/src/features/Search/index.tsx b/src/features/Search/index.tsx index 23ff064e..bb369e07 100644 --- a/src/features/Search/index.tsx +++ b/src/features/Search/index.tsx @@ -1,3 +1,5 @@ +import { useRef, useEffect } from 'react' + import { useRouteMatch } from 'react-router-dom' import isEmpty from 'lodash/isEmpty' @@ -39,6 +41,12 @@ export const Search = () => { showResults, } = useSearch() + const listRef = useRef(null) + + useEffect(() => { + listRef.current?.scrollTo(0, 0) + }, [selectedTab]) + const isMatch = useRouteMatch(`/:sportName${PAGES.match}/:pageId`)?.isExact || false return ( @@ -62,7 +70,7 @@ export const Search = () => { )} - {showResults && ( + {(showResults && query !== '') && ( { - +