mirror of
https://github.com/urbit/shrub.git
synced 2025-01-03 10:02:32 +03:00
chat-js: made scrollback work for new message indexing
This commit is contained in:
parent
8ffca926e7
commit
98f4df14a4
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user