0
0
Fork 0

Fix notification screen crashing in rare cases where the status no longer exists (#31403)

This commit is contained in:
Renaud Chaput 2024-08-14 08:47:15 +02:00 committed by GitHub
parent 6bd7da72e9
commit 0d85a79f19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 9 deletions

View file

@ -37,7 +37,11 @@ export const NotificationMention: React.FC<{
unread: boolean;
}> = ({ notification, unread }) => {
const [isDirect, isReply] = useAppSelector((state) => {
const status = state.statuses.get(notification.statusId) as Status;
const status = state.statuses.get(notification.statusId) as
| Status
| undefined;
if (!status) return [false, false] as const;
return [
status.get('visibility') === 'direct',

View file

@ -23,7 +23,7 @@ export const NotificationWithStatus: React.FC<{
icon: IconProp;
iconId: string;
accountIds: string[];
statusId: string;
statusId: string | undefined;
count: number;
labelRenderer: LabelRenderer;
unread: boolean;
@ -76,6 +76,8 @@ export const NotificationWithStatus: React.FC<{
[dispatch, statusId],
);
if (!statusId) return null;
return (
<HotKeys handlers={handlers}>
<div