From 98f4df14a496ef7b5b007771e659d9882a32332d Mon Sep 17 00:00:00 2001 From: Logan Allen Date: Fri, 10 Apr 2020 22:22:14 +0000 Subject: [PATCH] chat-js: made scrollback work for new message indexing --- pkg/interface/chat/src/js/components/chat.js | 10 +++++----- pkg/interface/chat/src/js/reducers/chat-update.js | 2 -- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/pkg/interface/chat/src/js/components/chat.js b/pkg/interface/chat/src/js/components/chat.js index e596e66d6d..cf5ba89368 100644 --- a/pkg/interface/chat/src/js/components/chat.js +++ b/pkg/interface/chat/src/js/components/chat.js @@ -75,8 +75,7 @@ export class ChatScreen extends Component { props.history.push("/~chat"); } else if ( - props.envelopes.length - prevProps.envelopes.length >= - 200 + props.envelopes.length >= prevProps.envelopes.length + 10 ) { this.hasAskedForMessages = false; } @@ -107,11 +106,12 @@ export class ChatScreen extends Component { return; } - let start = props.envelopes[props.envelopes.length - 1].number; + let start = + props.length - props.envelopes[props.envelopes.length - 1].number; if (start > 0) { - let end = start + 200 < props.length ? start + 200 : props.length; + let end = start + 300 < props.length ? start + 300 : props.length; this.hasAskedForMessages = true; - props.subscription.fetchMessages(start, end, props.station); + props.subscription.fetchMessages(start + 1, end, props.station); } } diff --git a/pkg/interface/chat/src/js/reducers/chat-update.js b/pkg/interface/chat/src/js/reducers/chat-update.js index 270e3723d4..7ded8c4437 100644 --- a/pkg/interface/chat/src/js/reducers/chat-update.js +++ b/pkg/interface/chat/src/js/reducers/chat-update.js @@ -28,8 +28,6 @@ export class ChatUpdateReducer { if (data) { state.inbox[data.path].envelopes = state.inbox[data.path].envelopes.concat(data.envelopes); - state.inbox[data.path].config.length = - state.inbox[data.path].config.length + data.envelopes.length; } }