diff --git a/app/views/RoomView/List.js b/app/views/RoomView/List.js index fcafe65e7..ed05af242 100644 --- a/app/views/RoomView/List.js +++ b/app/views/RoomView/List.js @@ -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) { diff --git a/app/views/RoomView/index.js b/app/views/RoomView/index.js index e57ff2e12..68487a042 100644 --- a/app/views/RoomView/index.js +++ b/app/views/RoomView/index.js @@ -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) {