mirror of
https://github.com/ilyakooo0/urbit.git
synced 2025-01-07 07:30:23 +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");
|
props.history.push("/~chat");
|
||||||
} else if (
|
} else if (
|
||||||
props.envelopes.length - prevProps.envelopes.length >=
|
props.envelopes.length >= prevProps.envelopes.length + 10
|
||||||
200
|
|
||||||
) {
|
) {
|
||||||
this.hasAskedForMessages = false;
|
this.hasAskedForMessages = false;
|
||||||
}
|
}
|
||||||
@ -107,11 +106,12 @@ export class ChatScreen extends Component {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let start = props.envelopes[props.envelopes.length - 1].number;
|
let start =
|
||||||
|
props.length - props.envelopes[props.envelopes.length - 1].number;
|
||||||
if (start > 0) {
|
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;
|
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) {
|
if (data) {
|
||||||
state.inbox[data.path].envelopes =
|
state.inbox[data.path].envelopes =
|
||||||
state.inbox[data.path].envelopes.concat(data.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