diff --git a/app/soapbox/normalizers/chat_message.ts b/app/soapbox/normalizers/chat_message.ts index bdf2653a9..393f950af 100644 --- a/app/soapbox/normalizers/chat_message.ts +++ b/app/soapbox/normalizers/chat_message.ts @@ -15,13 +15,13 @@ export const ChatMessageRecord = ImmutableRecord({ card: null as Card | null, chat_id: '', content: '', - created_at: new Date(), + created_at: '', emojis: ImmutableList(), id: '', unread: false, deleting: false, - pending: false, + pending: false as boolean | undefined, }); const normalizeMedia = (status: ImmutableMap) => { diff --git a/app/soapbox/queries/chats.ts b/app/soapbox/queries/chats.ts index b9e6a36e3..ec2c2542a 100644 --- a/app/soapbox/queries/chats.ts +++ b/app/soapbox/queries/chats.ts @@ -9,6 +9,7 @@ import compareId from 'soapbox/compare_id'; import { useChatContext } from 'soapbox/contexts/chat-context'; import { useStatContext } from 'soapbox/contexts/stat-context'; import { useApi, useAppDispatch, useAppSelector, useFeatures } from 'soapbox/hooks'; +import { normalizeChatMessage } from 'soapbox/normalizers'; import { flattenPages, PaginatedResult, updatePageItem } from 'soapbox/utils/queries'; import { queryClient } from './client'; @@ -91,7 +92,7 @@ const useChatMessages = (chat: IChat) => { const link = getNextLink(response); const hasMore = !!link; - const result = data.sort(reverseOrder); + const result = data.sort(reverseOrder).map(normalizeChatMessage); return { result,