Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions news/2 Fixes/8215.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent code from changing in the Notebook Editor while running a cell.
25 changes: 10 additions & 15 deletions src/datascience-ui/interactive-common/mainStateController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit confused as to why it was the way it was before. If state was the same we did want to update source?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm. Not sure why. Maybe for live share? You'd get an update as the user typed?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, maybe that was it. I think we commented out part of the lines above when we disabled live share, but not this part. In any case seems good now.


In reply to: 341397570 [](ancestors = 341397570)

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,
Expand Down