[FIX] Messages stop loading (#1410)
This commit is contained in:
parent
e5791215a4
commit
4ace446334
|
@ -71,6 +71,7 @@ export class List extends React.Component {
|
|||
.observeWithColumns(['_updated_at']);
|
||||
}
|
||||
|
||||
this.unsubscribeMessages();
|
||||
this.messagesSubscription = this.messagesObservable
|
||||
.subscribe((data) => {
|
||||
this.interaction = InteractionManager.runAfterInteractions(() => {
|
||||
|
@ -109,9 +110,7 @@ export class List extends React.Component {
|
|||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.messagesSubscription && this.messagesSubscription.unsubscribe) {
|
||||
this.messagesSubscription.unsubscribe();
|
||||
}
|
||||
this.unsubscribeMessages();
|
||||
if (this.interaction && this.interaction.cancel) {
|
||||
this.interaction.cancel();
|
||||
}
|
||||
|
@ -161,6 +160,12 @@ export class List extends React.Component {
|
|||
this.update();
|
||||
}, 300)
|
||||
|
||||
unsubscribeMessages = () => {
|
||||
if (this.messagesSubscription && this.messagesSubscription.unsubscribe) {
|
||||
this.messagesSubscription.unsubscribe();
|
||||
}
|
||||
}
|
||||
|
||||
renderFooter = () => {
|
||||
const { loading } = this.state;
|
||||
if (loading) {
|
||||
|
|
|
@ -202,6 +202,10 @@ class RoomView extends React.Component {
|
|||
if (appState === 'foreground' && appState !== prevProps.appState) {
|
||||
this.onForegroundInteraction = InteractionManager.runAfterInteractions(() => {
|
||||
this.init();
|
||||
// Fire List.init() just to keep observables working
|
||||
if (this.list && this.list.current) {
|
||||
this.list.current.init();
|
||||
}
|
||||
});
|
||||
}
|
||||
if (appState === 'background' && appState !== prevProps.appState) {
|
||||
|
|
Loading…
Reference in New Issue