Skip to content

Commit 82611ba

Browse files
author
Alan Fleming
committed
WidgetModel: set comm_live to false when comm closed and remove redundant comm_closed argument.
1 parent 7b4d13c commit 82611ba

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

packages/base/src/widget.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -214,17 +214,15 @@ export class WidgetModel extends Backbone.Model {
214214
/**
215215
* Close model
216216
*
217-
* @param comm_closed - true if the comm is already being closed. If false, the comm will be closed.
218-
*
219217
* @returns - a promise that is fulfilled when all the associated views have been removed.
220218
*/
221-
close(comm_closed = false): Promise<void> {
219+
close(): Promise<void> {
222220
// can only be closed once.
223221
if (this._closed) {
224222
return Promise.resolve();
225223
}
226224
this._closed = true;
227-
if (this.comm && !comm_closed) {
225+
if (this.comm && this.comm_live) {
228226
this.comm.close();
229227
}
230228
this.stopListening();
@@ -249,8 +247,11 @@ export class WidgetModel extends Backbone.Model {
249247
* Handle when a widget comm is closed.
250248
*/
251249
_handle_comm_closed(msg: KernelMessage.ICommCloseMsg): void {
250+
this.comm_live = false;
251+
if (this._closed) {
252+
this.close();
253+
}
252254
this.trigger('comm:close');
253-
this.close(true);
254255
}
255256

256257
/**

0 commit comments

Comments
 (0)