Skip to content

Commit

Permalink
Update outdated chatStore logic after rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
adzialocha committed Apr 15, 2024
1 parent 4a0a2cb commit 713c74c
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions src/renderer/components/message/MessageList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import React, {
useMemo,
} from 'react'
import classNames from 'classnames'
import { C, T } from '@deltachat/jsonrpc-client'
import moment from 'moment'
import { C } from '@deltachat/jsonrpc-client'
import { debounce } from 'debounce'

import { MessageWrapper } from './MessageWrapper'
import { getLogger } from '../../../shared/logger'
Expand All @@ -20,12 +21,14 @@ import { debouncedUpdateBadgeCounter } from '../../system-integration/badge-coun
import { MessagesDisplayContext } from '../../contexts/MessagesDisplayContext'
import useTranslationFunction from '../../hooks/useTranslationFunction'
import useKeyBindingAction from '../../hooks/useKeyBindingAction'
import useHasChanged from '../../hooks/useHasChanged'
import { useReactionsBar } from '../ReactionsBar'
import EmptyChatMessage from './EmptyChatMessage'
import { debounce } from 'debounce'

const log = getLogger('render/components/message/MessageList')

import type { T } from '@deltachat/jsonrpc-client'

type ChatTypes =
| C.DC_CHAT_TYPE_SINGLE
| C.DC_CHAT_TYPE_GROUP
Expand Down Expand Up @@ -544,12 +547,13 @@ export const MessageListInner = React.memo(

onScroll(...args)
}
const [prevChatStore, setPrevChatStore] = useState(chatStore)
const hasChatChanged = useHasChanged(chat)
const [switchedChatAt, setSwitchedChatAt] = useState(0)
if (chatStore !== prevChatStore) {
setPrevChatStore(chatStore)
setSwitchedChatAt(Date.now())
}
useEffect(() => {
if (hasChatChanged) {
setSwitchedChatAt(Date.now())
}
}, [hasChatChanged])

if (!loaded) {
return (
Expand Down

0 comments on commit 713c74c

Please sign in to comment.