From ee413f3b246addb46165c44711f10364f6c73c4c Mon Sep 17 00:00:00 2001 From: Chris LaFreniere <40371649+chlafreniere@users.noreply.github.com> Date: Wed, 27 Mar 2019 19:04:07 -0700 Subject: [PATCH] Ensure only one cell shows as running at a time (#4715) --- src/sql/parts/notebook/models/cell.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/sql/parts/notebook/models/cell.ts b/src/sql/parts/notebook/models/cell.ts index 902801317e..48c9eed199 100644 --- a/src/sql/parts/notebook/models/cell.ts +++ b/src/sql/parts/notebook/models/cell.ts @@ -239,6 +239,7 @@ export class CellModel implements ICellModel { this.sendNotification(notificationService, Severity.Error, message); // TODO track error state for the cell } finally { + this.disposeFuture(); this.fireExecutionStateChanged(); } @@ -324,8 +325,7 @@ export class CellModel implements ICellModel { let output: nb.ICellOutput = msg.content as nb.ICellOutput; if (!this._future.inProgress) { - this._future.dispose(); - this._future = undefined; + this.disposeFuture(); } } @@ -487,4 +487,10 @@ export class CellModel implements ICellModel { } return endpoint; } + + // Dispose and set current future to undefined + private disposeFuture() { + this._future.dispose(); + this._future = undefined; + } }