Fix load more
This commit is contained in:
parent
537cd0032e
commit
1ea3916e94
|
@ -12,7 +12,6 @@ export type MessageType =
|
||||||
| 'jitsi_call_started'
|
| 'jitsi_call_started'
|
||||||
| 'discussion-created'
|
| 'discussion-created'
|
||||||
| 'e2e'
|
| 'e2e'
|
||||||
| 'load_more'
|
|
||||||
| 'rm'
|
| 'rm'
|
||||||
| 'uj'
|
| 'uj'
|
||||||
| MessageTypeLoad
|
| MessageTypeLoad
|
||||||
|
|
|
@ -19,7 +19,7 @@ import NavBottomFAB from './NavBottomFAB';
|
||||||
import { loadMissedMessages, loadThreadMessages } from '../../../lib/methods';
|
import { loadMissedMessages, loadThreadMessages } from '../../../lib/methods';
|
||||||
import { Services } from '../../../lib/services';
|
import { Services } from '../../../lib/services';
|
||||||
import { TSupportedThemes, withTheme } from '../../../theme';
|
import { TSupportedThemes, withTheme } from '../../../theme';
|
||||||
import { themes } from '../../../lib/constants';
|
import { MESSAGE_TYPE_ANY_LOAD, themes } from '../../../lib/constants';
|
||||||
|
|
||||||
const QUERY_SIZE = 50;
|
const QUERY_SIZE = 50;
|
||||||
|
|
||||||
|
@ -186,8 +186,14 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
|
||||||
this.unsubscribeMessages();
|
this.unsubscribeMessages();
|
||||||
this.messagesSubscription = this.messagesObservable?.subscribe(messages => {
|
this.messagesSubscription = this.messagesObservable?.subscribe(messages => {
|
||||||
// @ts-ignore is this enough cols?
|
// @ts-ignore is this enough cols?
|
||||||
messages = messages.map(m => ({
|
messages = messages.map(m => {
|
||||||
|
if (MESSAGE_TYPE_ANY_LOAD.includes(m.t)) {
|
||||||
|
return m;
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
id: m.id,
|
id: m.id,
|
||||||
|
_id: m._id,
|
||||||
msg: m.msg,
|
msg: m.msg,
|
||||||
ts: m.ts,
|
ts: m.ts,
|
||||||
status: m.status,
|
status: m.status,
|
||||||
|
@ -216,7 +222,8 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
|
||||||
replies: m.replies,
|
replies: m.replies,
|
||||||
md: m.md,
|
md: m.md,
|
||||||
comment: m.comment
|
comment: m.comment
|
||||||
}));
|
};
|
||||||
|
});
|
||||||
if (tmid && this.thread) {
|
if (tmid && this.thread) {
|
||||||
messages = [...messages, this.thread];
|
messages = [...messages, this.thread];
|
||||||
}
|
}
|
||||||
|
@ -233,7 +240,6 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
|
||||||
// if (this.animated) {
|
// if (this.animated) {
|
||||||
// animateNextTransition();
|
// animateNextTransition();
|
||||||
// }
|
// }
|
||||||
// this.setState({ messages }, () => this.update());
|
|
||||||
this.setState({ messages });
|
this.setState({ messages });
|
||||||
} else {
|
} else {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
@ -284,13 +290,6 @@ class ListContainer extends React.Component<IListContainerProps, IListContainerS
|
||||||
this.setState({ refreshing: false });
|
this.setState({ refreshing: false });
|
||||||
});
|
});
|
||||||
|
|
||||||
update = () => {
|
|
||||||
if (this.animated) {
|
|
||||||
animateNextTransition();
|
|
||||||
}
|
|
||||||
// this.forceUpdate();
|
|
||||||
};
|
|
||||||
|
|
||||||
unsubscribeMessages = () => {
|
unsubscribeMessages = () => {
|
||||||
if (this.messagesSubscription && this.messagesSubscription.unsubscribe) {
|
if (this.messagesSubscription && this.messagesSubscription.unsubscribe) {
|
||||||
this.messagesSubscription.unsubscribe();
|
this.messagesSubscription.unsubscribe();
|
||||||
|
|
Loading…
Reference in New Issue