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/7844.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Prevent updates to the cell text when cell execution of the same cell has commenced or completed.
21 changes: 18 additions & 3 deletions src/datascience-ui/interactive-common/mainStateController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1112,10 +1112,25 @@ export class MainStateController implements IMessageHandler {
// we won't actually update.
const newVMs = [...this.pendingState.cellVMs];

// Live share has been disabled for now, see https://github.com/microsoft/vscode-python/issues/7972
// Check to see if our code still matches for the cell (in liveshare it might be updated from the other side)
if (concatMultilineString(this.pendingState.cellVMs[index].cell.data.source) !== concatMultilineString(cell.data.source)) {
const newText = extractInputText(cell, getSettings());
newVMs[index] = { ...newVMs[index], cell: cell, inputBlockText: newText };
// if (concatMultilineString(this.pendingState.cellVMs[index].cell.data.source) !== concatMultilineString(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
}
}
};
} else {
newVMs[index] = { ...newVMs[index], cell: cell };
}
Expand Down