[FIX] Fix crash when deleting scheduled post (#112)

This commit is contained in:
Clovis 2022-12-24 15:13:59 +01:00 committed by GitHub
parent 67a83a8f56
commit 5c5f42dcaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -14,9 +14,12 @@ export const buildStatus = (state: RootState, scheduledStatus: ScheduledStatus)
const account = getAccount(state, me);
if (!scheduledStatus) return null;
const status = ImmutableMap({
account,
content: scheduledStatus.text.replace(new RegExp('\n', 'g'), '<br>'), /* eslint-disable-line no-control-regex */
// eslint-disable-next-line no-control-regex
content: scheduledStatus.text.replace(new RegExp('\n', 'g'), '<br>'),
created_at: scheduledStatus.scheduled_at,
id: scheduledStatus.id,
in_reply_to_id: scheduledStatus.in_reply_to_id,

View file

@ -20,7 +20,7 @@ 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) => buildStatus(state, state.scheduled_statuses.get(statusId))) as StatusEntity;
if (!status) return null;