chat: hotfix new message indicator

This commit is contained in:
Tyler Brown Cifu Shuster 2020-09-08 19:56:07 -07:00
parent 3d739c03c2
commit 05dd5d65cb

View File

@ -157,7 +157,7 @@ export class ChatWindow extends Component<ChatWindowProps, ChatWindowState> {
if (!idle) {
idle = true;
}
} else if (idle) {
} else if (idle && (unreadCount === 0 || this.state.range.endIndex === 0)) {
idle = false;
}
this.setState({ idle });
@ -172,6 +172,10 @@ export class ChatWindow extends Component<ChatWindowProps, ChatWindowState> {
if (!idle && prevProps.unreadCount !== unreadCount) {
this.virtualList.current?.scrollToIndex(mailboxSize);
}
if (!idle && envelopes.length !== prevProps.envelopes.length) {
this.virtualList.current?.scrollToIndex(mailboxSize);
}
}
scrollToUnread() {
@ -244,7 +248,7 @@ export class ChatWindow extends Component<ChatWindowProps, ChatWindowState> {
<Fragment>
<UnreadNotice
unreadCount={unreadCount}
unreadMsg={unreadMsg}
unreadMsg={this.state.idle ? unreadMsg : false}
dismissUnread={this.dismissUnread}
onClick={this.scrollToUnread}
/>
@ -282,6 +286,7 @@ export class ChatWindow extends Component<ChatWindowProps, ChatWindowState> {
isFirstUnread={
unreadCount
&& mailboxSize - unreadCount === number
&& this.state.idle
}
msg={msg}
previousMsg={messages[number + 1]}