Fixed: Override modal not closed after grabbing

This commit is contained in:
Mark McDowall 2023-04-21 17:28:53 -07:00
parent 183b10f79a
commit 6fe5573298
1 changed files with 8 additions and 0 deletions

View File

@ -11,6 +11,7 @@ import ModalHeader from 'Components/Modal/ModalHeader';
import DownloadProtocol from 'DownloadClient/DownloadProtocol';
import EpisodeLanguages from 'Episode/EpisodeLanguages';
import EpisodeQuality from 'Episode/EpisodeQuality';
import usePrevious from 'Helpers/Hooks/usePrevious';
import SelectEpisodeModal from 'InteractiveImport/Episode/SelectEpisodeModal';
import { SelectedEpisode } from 'InteractiveImport/Episode/SelectEpisodeModalContent';
import SelectLanguageModal from 'InteractiveImport/Language/SelectLanguageModal';
@ -76,6 +77,7 @@ function OverrideMatchModalContent(props: OverrideMatchModalContentProps) {
const [selectModalOpen, setSelectModalOpen] = useState<SelectType | null>(
null
);
const previousIsGrabbing = usePrevious(isGrabbing);
const dispatch = useDispatch();
const series: Series | undefined = useSelector(
@ -220,6 +222,12 @@ function OverrideMatchModalContent(props: OverrideMatchModalContentProps) {
dispatch,
]);
useEffect(() => {
if (!isGrabbing && previousIsGrabbing) {
onModalClose();
}
}, [isGrabbing, previousIsGrabbing, onModalClose]);
useEffect(
() => {
dispatch(fetchDownloadClients());