Skip to content

Commit

Permalink
Ensure form client's update listener is disposed properly
Browse files Browse the repository at this point in the history
Fixes #36
  • Loading branch information
martin-fleck-at committed Nov 29, 2023
1 parent 3481ce5 commit 0bd13d9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions packages/form-client/src/browser/form-editor-widget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,13 @@ export class FormEditorWidget extends ReactWidget implements NavigatableWidget,
this.getResourceUri = this.getResourceUri.bind(this);
this.loadModel();

this.formClient.onUpdate(event => {
if (event.sourceClientId !== FORM_CLIENT_ID && event.uri === this.getResourceUri().toString()) {
this.modelUpdated(event.model);
}
});
this.toDispose.push(
this.formClient.onUpdate(event => {
if (event.sourceClientId !== FORM_CLIENT_ID && event.uri === this.getResourceUri().toString()) {
this.modelUpdated(event.model);
}
})
);
}

protected async loadModel(): Promise<void> {
Expand Down

0 comments on commit 0bd13d9

Please sign in to comment.