Fix notification screen crashing in rare cases where the status no longer exists (#31403)
This commit is contained in:
parent
6bd7da72e9
commit
0d85a79f19
5 changed files with 15 additions and 9 deletions
|
@ -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',
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue