don't crash when we don't have a subscription anymore
This commit is contained in:
parent
c91290fac2
commit
9ea961ae53
2 changed files with 10 additions and 0 deletions
|
@ -25,6 +25,7 @@ export class ViewModel extends EventEmitter {
|
||||||
constructor({clock, emitChange} = {}) {
|
constructor({clock, emitChange} = {}) {
|
||||||
super();
|
super();
|
||||||
this.disposables = null;
|
this.disposables = null;
|
||||||
|
this._isDisposed = false;
|
||||||
this._options = {clock, emitChange};
|
this._options = {clock, emitChange};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,6 +44,11 @@ export class ViewModel extends EventEmitter {
|
||||||
if (this.disposables) {
|
if (this.disposables) {
|
||||||
this.disposables.dispose();
|
this.disposables.dispose();
|
||||||
}
|
}
|
||||||
|
this._isDisposed = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
get isDisposed() {
|
||||||
|
return this._isDisposed;
|
||||||
}
|
}
|
||||||
|
|
||||||
disposeTracked(disposable) {
|
disposeTracked(disposable) {
|
||||||
|
|
|
@ -50,6 +50,10 @@ export class TimelineViewModel extends ViewModel {
|
||||||
* @return {bool} startReached if the start of the timeline was reached
|
* @return {bool} startReached if the start of the timeline was reached
|
||||||
*/
|
*/
|
||||||
async loadAtTop() {
|
async loadAtTop() {
|
||||||
|
if (this.isDisposed) {
|
||||||
|
// stop loading more, we switched room
|
||||||
|
return true;
|
||||||
|
}
|
||||||
const firstTile = this._tiles.getFirst();
|
const firstTile = this._tiles.getFirst();
|
||||||
if (firstTile.shape === "gap") {
|
if (firstTile.shape === "gap") {
|
||||||
return firstTile.fill();
|
return firstTile.fill();
|
||||||
|
|
Reference in a new issue