[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']);
|
.observeWithColumns(['_updated_at']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.unsubscribeMessages();
|
||||||
this.messagesSubscription = this.messagesObservable
|
this.messagesSubscription = this.messagesObservable
|
||||||
.subscribe((data) => {
|
.subscribe((data) => {
|
||||||
this.interaction = InteractionManager.runAfterInteractions(() => {
|
this.interaction = InteractionManager.runAfterInteractions(() => {
|
||||||
|
@ -109,9 +110,7 @@ export class List extends React.Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
if (this.messagesSubscription && this.messagesSubscription.unsubscribe) {
|
this.unsubscribeMessages();
|
||||||
this.messagesSubscription.unsubscribe();
|
|
||||||
}
|
|
||||||
if (this.interaction && this.interaction.cancel) {
|
if (this.interaction && this.interaction.cancel) {
|
||||||
this.interaction.cancel();
|
this.interaction.cancel();
|
||||||
}
|
}
|
||||||
|
@ -161,6 +160,12 @@ export class List extends React.Component {
|
||||||
this.update();
|
this.update();
|
||||||
}, 300)
|
}, 300)
|
||||||
|
|
||||||
|
unsubscribeMessages = () => {
|
||||||
|
if (this.messagesSubscription && this.messagesSubscription.unsubscribe) {
|
||||||
|
this.messagesSubscription.unsubscribe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
renderFooter = () => {
|
renderFooter = () => {
|
||||||
const { loading } = this.state;
|
const { loading } = this.state;
|
||||||
if (loading) {
|
if (loading) {
|
||||||
|
|
|
@ -202,6 +202,10 @@ class RoomView extends React.Component {
|
||||||
if (appState === 'foreground' && appState !== prevProps.appState) {
|
if (appState === 'foreground' && appState !== prevProps.appState) {
|
||||||
this.onForegroundInteraction = InteractionManager.runAfterInteractions(() => {
|
this.onForegroundInteraction = InteractionManager.runAfterInteractions(() => {
|
||||||
this.init();
|
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) {
|
if (appState === 'background' && appState !== prevProps.appState) {
|
||||||
|
|
Loading…
Reference in New Issue