mirror of
https://gitlab.com/MrFry/qmining-page
synced 2025-04-01 20:23:44 +02:00
Chat fix view prev msgs scroll
This commit is contained in:
parent
8e4e24bed6
commit
4f82b9d8c9
1 changed files with 6 additions and 5 deletions
|
@ -151,11 +151,12 @@ export default class Chat extends React.Component {
|
|||
this.connect(this.props.globalData.userId)
|
||||
}
|
||||
|
||||
if (
|
||||
countAllMessages(prevState.msgs) !== countAllMessages(this.state.msgs) ||
|
||||
prevState.selectedUser !== this.state.selectedUser
|
||||
) {
|
||||
this.scrollToChatBottom()
|
||||
if (prevState.selectedUser) {
|
||||
const prevLatest = prevState.msgs[prevState.selectedUser].lastMessage
|
||||
const newLatest = this.state.msgs[this.state.selectedUser].lastMessage
|
||||
if (prevLatest.date !== newLatest.date) {
|
||||
this.scrollToChatBottom()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue