Fix scheduled statuses page crashing on delete

Signed-off-by: marcin mikołajczak <git@mkljczk.pl>
This commit is contained in:
marcin mikołajczak 2023-01-01 23:21:05 +01:00
parent 393928a5c7
commit ea2bb53379

View file

@ -20,7 +20,12 @@ interface IScheduledStatus {
}
const ScheduledStatus: React.FC<IScheduledStatus> = ({ statusId, ...other }) => {
const status = useAppSelector((state) => buildStatus(state, state.scheduled_statuses.get(statusId)!)) as StatusEntity;
const status = useAppSelector((state) => {
const scheduledStatus = state.scheduled_statuses.get(statusId);
if (!scheduledStatus) return null;
return buildStatus(state, scheduledStatus);
}) as StatusEntity | null;
if (!status) return null;