mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 03:25:12 +01:00
don't crash when we don't have a subscription anymore
This commit is contained in:
parent
c91290fac2
commit
9ea961ae53
@ -25,6 +25,7 @@ export class ViewModel extends EventEmitter {
|
||||
constructor({clock, emitChange} = {}) {
|
||||
super();
|
||||
this.disposables = null;
|
||||
this._isDisposed = false;
|
||||
this._options = {clock, emitChange};
|
||||
}
|
||||
|
||||
@ -43,6 +44,11 @@ export class ViewModel extends EventEmitter {
|
||||
if (this.disposables) {
|
||||
this.disposables.dispose();
|
||||
}
|
||||
this._isDisposed = true;
|
||||
}
|
||||
|
||||
get isDisposed() {
|
||||
return this._isDisposed;
|
||||
}
|
||||
|
||||
disposeTracked(disposable) {
|
||||
|
@ -50,6 +50,10 @@ export class TimelineViewModel extends ViewModel {
|
||||
* @return {bool} startReached if the start of the timeline was reached
|
||||
*/
|
||||
async loadAtTop() {
|
||||
if (this.isDisposed) {
|
||||
// stop loading more, we switched room
|
||||
return true;
|
||||
}
|
||||
const firstTile = this._tiles.getFirst();
|
||||
if (firstTile.shape === "gap") {
|
||||
return firstTile.fill();
|
||||
|
Loading…
Reference in New Issue
Block a user