mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-11 08:55:23 +03:00
Merge pull request #2606 from urbit/la-scrollback
Scrollback fixed and tested in Brave, Safari, and Chrome
This commit is contained in:
commit
b8a222ea75
@ -101,7 +101,7 @@
|
||||
?: ?=([%http-response *] path)
|
||||
[~ this]
|
||||
?: =(/primary path)
|
||||
:: create inbox with 100 messages max per mailbox and send that along
|
||||
:: create inbox with 20 messages max per mailbox and send that along
|
||||
:: then quit the subscription
|
||||
:_ this
|
||||
[%give %fact ~ %json !>((inbox-to-json truncated-inbox-scry))]~
|
||||
@ -109,7 +109,7 @@
|
||||
[[%give %fact ~ %json !>(*json)]~ this]
|
||||
(on-watch:def path)
|
||||
::
|
||||
++ message-limit 25
|
||||
++ message-limit 20
|
||||
::
|
||||
++ truncated-inbox-scry
|
||||
^- inbox
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -33,6 +33,7 @@ export class ChatScreen extends Component {
|
||||
|
||||
componentDidMount() {
|
||||
this.updateReadNumber();
|
||||
this.askForMessages();
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
@ -51,6 +52,10 @@ export class ChatScreen extends Component {
|
||||
) {
|
||||
this.hasAskedForMessages = false;
|
||||
|
||||
if (props.envelopes.length < 100) {
|
||||
this.askForMessages();
|
||||
}
|
||||
|
||||
clearInterval(this.updateReadInterval);
|
||||
|
||||
this.setState(
|
||||
@ -84,14 +89,21 @@ export class ChatScreen extends Component {
|
||||
askForMessages() {
|
||||
const { props, state } = this;
|
||||
|
||||
if (props.envelopes.length === 0) {
|
||||
setTimeout(() => {
|
||||
this.askForMessages();
|
||||
}, 500);
|
||||
return;
|
||||
}
|
||||
|
||||
if (
|
||||
state.numPages * 100 < props.length - 400 ||
|
||||
this.hasAskedForMessages
|
||||
state.numPages * 100 > props.length - 400 ||
|
||||
this.hasAskedForMessages ||
|
||||
props.length <= 0
|
||||
) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (props.length > 0) {
|
||||
let end = props.envelopes[0].number;
|
||||
if (end > 0) {
|
||||
let start = end - 400 > 0 ? end - 400 : 0;
|
||||
@ -105,7 +117,6 @@ export class ChatScreen extends Component {
|
||||
props.subscription.fetchMessages(start, end - 1, props.station);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
scrollToBottom() {
|
||||
if (!this.state.scrollLocked && this.scrollElement) {
|
||||
|
@ -400,6 +400,7 @@ export class ChatInput extends Component {
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
if (message.length > 0) {
|
||||
message = message.join(" ");
|
||||
message = this.getLetterType(message);
|
||||
@ -412,7 +413,8 @@ export class ChatInput extends Component {
|
||||
message = [];
|
||||
}
|
||||
|
||||
// perf: setTimeout(this.closure, 2000);
|
||||
// perf:
|
||||
//setTimeout(this.closure, 2000);
|
||||
|
||||
this.setState({
|
||||
message: '',
|
||||
|
Loading…
Reference in New Issue
Block a user