Merge pull request #678 from vector-im/fix-viewmodel-error

Check options exist on emitChange
This commit is contained in:
Bruno Windels 2022-02-17 09:08:54 +01:00 committed by GitHub
commit d971fd1a47
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -110,7 +110,7 @@ export class ViewModel<O extends Options = Options> extends EventEmitter<{change
}
emitChange(changedProps: any): void {
if (this._options.emitChange) {
if (this._options?.emitChange) {
this._options.emitChange(changedProps);
} else {
this.emit("change", changedProps);