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