From e2fdd86a7642799186a038e6e5b8600f81335813 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Mon, 31 May 2021 19:58:19 -0500 Subject: [PATCH] Filter out invalid chats, fixes #648 --- app/soapbox/features/chats/components/chat_panes.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/soapbox/features/chats/components/chat_panes.js b/app/soapbox/features/chats/components/chat_panes.js index d16a02ee6..46e3e4260 100644 --- a/app/soapbox/features/chats/components/chat_panes.js +++ b/app/soapbox/features/chats/components/chat_panes.js @@ -12,14 +12,16 @@ import { openChat, toggleMainWindow } from 'soapbox/actions/chats'; import ChatWindow from './chat_window'; import { shortNumberFormat } from 'soapbox/utils/numbers'; import AudioToggle from 'soapbox/features/chats/components/audio_toggle'; +import { List as ImmutableList } from 'immutable'; const addChatsToPanes = (state, panesData) => { const getChat = makeGetChat(); - const newPanes = panesData.get('panes').map(pane => { + const newPanes = panesData.get('panes').reduce((acc, pane) => { const chat = getChat(state, { id: pane.get('chat_id') }); - return pane.set('chat', chat); - }); + if (!chat) return acc; + return acc.push(pane.set('chat', chat)); + }, ImmutableList()); return panesData.set('panes', newPanes); };