fix: deregister stream observers on editor deinit
This commit is contained in:
@@ -30,6 +30,15 @@ export class Editor {
|
||||
);
|
||||
}
|
||||
|
||||
deinit() {
|
||||
this.removeStreamObserver();
|
||||
(this.removeStreamObserver as any) = undefined;
|
||||
this._onNoteChange = undefined;
|
||||
(this.application as any) = undefined;
|
||||
this._onNoteChange = undefined;
|
||||
this._onNoteValueChange = undefined;
|
||||
}
|
||||
|
||||
private async handleNoteStream(notes: SNNote[], source?: PayloadSource) {
|
||||
/** Update our note object reference whenever it changes */
|
||||
const matchingNote = notes.find((item) => {
|
||||
@@ -63,15 +72,6 @@ export class Editor {
|
||||
this.setNote(note as SNNote);
|
||||
}
|
||||
|
||||
deinit() {
|
||||
this.removeStreamObserver();
|
||||
(this.removeStreamObserver as any) = undefined;
|
||||
this._onNoteChange = undefined;
|
||||
(this.application as any) = undefined;
|
||||
this._onNoteChange = undefined;
|
||||
this._onNoteValueChange = undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register to be notified when the editor's note changes.
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user