Fixed: Interactive searches causing multiple requests to indexers

This commit is contained in:
Mark McDowall 2024-09-16 12:16:26 -07:00 committed by Mark McDowall
parent fca8c36156
commit 3976e5daf7

View file

@ -161,13 +161,12 @@ function InteractiveSearch({ type, searchPayload }: InteractiveSearchProps) {
); );
useEffect(() => { useEffect(() => {
// If search results are not yet isPopulated fetch them, // Only fetch releases if they are not already being fetched and not yet populated.
// otherwise re-show the existing props.
if (!isPopulated) { if (!isFetching && !isPopulated) {
dispatch(fetchReleases(searchPayload)); dispatch(fetchReleases(searchPayload));
} }
}, [isPopulated, searchPayload, dispatch]); }, [isFetching, isPopulated, searchPayload, dispatch]);
const errorMessage = getErrorMessage(error); const errorMessage = getErrorMessage(error);