|
|
@ -8,7 +8,7 @@ export function useSearchQuery(): [ |
|
|
|
() => void |
|
|
|
() => void |
|
|
|
] { |
|
|
|
] { |
|
|
|
const history = useHistory(); |
|
|
|
const history = useHistory(); |
|
|
|
const isFirstRender = useRef(false); |
|
|
|
const isFirstRender = useRef(true); |
|
|
|
const { path, params } = useRouteMatch<{ type: string; query: string }>(); |
|
|
|
const { path, params } = useRouteMatch<{ type: string; query: string }>(); |
|
|
|
const [search, setSearch] = useState<MWQuery>({ |
|
|
|
const [search, setSearch] = useState<MWQuery>({ |
|
|
|
searchQuery: "", |
|
|
|
searchQuery: "", |
|
|
@ -40,11 +40,10 @@ export function useSearchQuery(): [ |
|
|
|
|
|
|
|
|
|
|
|
// only run on first load of the page
|
|
|
|
// only run on first load of the page
|
|
|
|
React.useEffect(() => { |
|
|
|
React.useEffect(() => { |
|
|
|
if (isFirstRender.current === true) { |
|
|
|
if (isFirstRender.current === false) { |
|
|
|
isFirstRender.current = false; |
|
|
|
|
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
isFirstRender.current = true; |
|
|
|
isFirstRender.current = false; |
|
|
|
const type = |
|
|
|
const type = |
|
|
|
Object.values(MWMediaType).find((v) => params.type === v) || |
|
|
|
Object.values(MWMediaType).find((v) => params.type === v) || |
|
|
|
MWMediaType.MOVIE; |
|
|
|
MWMediaType.MOVIE; |
|
|
|