From 8a39e0e3334bd76f4cec288cae46962728c52c28 Mon Sep 17 00:00:00 2001 From: Rich Chiodo Date: Thu, 31 Oct 2019 15:36:24 -0700 Subject: [PATCH] Never update cell contents from the extension side --- news/2 Fixes/8215.md | 1 + .../interactive-common/mainStateController.ts | 25 ++++++++----------- 2 files changed, 11 insertions(+), 15 deletions(-) create mode 100644 news/2 Fixes/8215.md diff --git a/news/2 Fixes/8215.md b/news/2 Fixes/8215.md new file mode 100644 index 000000000000..7cd48a27f9d4 --- /dev/null +++ b/news/2 Fixes/8215.md @@ -0,0 +1 @@ +Prevent code from changing in the Notebook Editor while running a cell. diff --git a/src/datascience-ui/interactive-common/mainStateController.ts b/src/datascience-ui/interactive-common/mainStateController.ts index c17515b9e5b0..905af7592611 100644 --- a/src/datascience-ui/interactive-common/mainStateController.ts +++ b/src/datascience-ui/interactive-common/mainStateController.ts @@ -1160,24 +1160,19 @@ export class MainStateController implements IMessageHandler { // Check to see if our code still matches for the cell (in liveshare it might be updated from the other side) // if (concatMultilineStringInput(this.pendingState.cellVMs[index].cell.data.source) !== concatMultilineStringInput(cell.data.source)) { - // If cell state changes, then update just the state and the cell data (excluding source). // Prevent updates to the source, as its possible we have recieved a response for a cell execution // and the user has updated the cell text since then. - if (this.pendingState.cellVMs[index].cell.state !== cell.state) { - newVMs[index] = { - ...newVMs[index], - cell: { - ...newVMs[index].cell, - state: cell.state, - data: { - ...cell.data, - source: newVMs[index].cell.data.source - } + newVMs[index] = { + ...newVMs[index], + cell: { + ...newVMs[index].cell, + state: cell.state, + data: { + ...cell.data, + source: newVMs[index].cell.data.source } - }; - } else { - newVMs[index] = { ...newVMs[index], cell: cell }; - } + } + }; this.setState({ cellVMs: newVMs,