Fixed: Movie Details crashing on invalid collection

pull/10926/head
Bogdan 1 month ago
parent 89666175a6
commit 4c8da09df6

@ -4,6 +4,7 @@ import MonitorToggleButton from 'Components/MonitorToggleButton';
import { toggleCollectionMonitored } from 'Store/Actions/movieCollectionActions';
import { createCollectionSelectorForHook } from 'Store/Selectors/createCollectionSelector';
import MovieCollection from 'typings/MovieCollection';
import translate from 'Utilities/String/translate';
import styles from './MovieCollectionLabel.css';
interface MovieCollectionLabelProps {
@ -16,7 +17,8 @@ function MovieCollectionLabel({ tmdbId }: MovieCollectionLabelProps) {
monitored,
title,
isSaving = false,
} = useSelector(createCollectionSelectorForHook(tmdbId)) as MovieCollection;
} = useSelector(createCollectionSelectorForHook(tmdbId)) ||
({} as MovieCollection);
const dispatch = useDispatch();
@ -29,6 +31,10 @@ function MovieCollectionLabel({ tmdbId }: MovieCollectionLabelProps) {
[id, dispatch]
);
if (!id) {
return translate('Unknown');
}
return (
<div>
<MonitorToggleButton

Loading…
Cancel
Save