chat-js: fixed scrollback for reverse message chatrooms

This commit is contained in:
Logan Allen 2020-04-10 17:29:23 -04:00
parent b85697cbec
commit 6d1efde884
2 changed files with 5 additions and 11 deletions

File diff suppressed because one or more lines are too long

View File

@ -100,7 +100,7 @@ export class ChatScreen extends Component {
}
if (
state.numPages * 100 >= props.length ||
props.envelopes.length >= props.length ||
this.hasAskedForMessages ||
props.length <= 0
) {
@ -108,16 +108,10 @@ export class ChatScreen extends Component {
}
let start = props.envelopes[props.envelopes.length - 1].number;
if (end > 0) {
let end = start + 400 < props.length ? start + 400 : props.length;
if (start === 0 && end === 1) {
return;
}
if (start > 0) {
let end = start + 200 < props.length ? start + 200 : props.length;
this.hasAskedForMessages = true;
props.subscription.fetchMessages(start, end - 1, props.station);
props.subscription.fetchMessages(start, end, props.station);
}
}