mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 10:58:30 -05:00
Notebooks: Fix Grids Not Rendering when Unsaved Notebook Reloaded (#12483)
* Clear Output and fix output change * Fix tests after forced clear + append output
This commit is contained in:
@@ -129,9 +129,11 @@ export class NotebookTextFileModel {
|
||||
}
|
||||
|
||||
public transformAndApplyEditForOutputUpdate(contentChange: NotebookContentChange, textEditorModel: ITextEditorModel): boolean {
|
||||
this.transformAndApplyEditForClearOutput(contentChange, textEditorModel);
|
||||
if (Array.isArray(contentChange.cells[0].outputs) && contentChange.cells[0].outputs.length > 0) {
|
||||
let newOutput = JSON.stringify(contentChange.cells[0].outputs[contentChange.cells[0].outputs.length - 1], undefined, ' ');
|
||||
if (contentChange.cells[0].outputs.length > 1) {
|
||||
for (let i = 0; i < contentChange.cells[0].outputs.length; i++) {
|
||||
let newOutput = JSON.stringify(contentChange.cells[0].outputs[i], undefined, ' ');
|
||||
if (i > 0) {
|
||||
newOutput = ', '.concat(newOutput);
|
||||
} else {
|
||||
newOutput = '\n'.concat(newOutput).concat('\n');
|
||||
@@ -149,9 +151,10 @@ export class NotebookTextFileModel {
|
||||
range: new Range(endOutputsRange.startLineNumber, endOutputsRange.startColumn, endOutputsRange.startLineNumber, endOutputsRange.startColumn),
|
||||
text: newOutput
|
||||
}]);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -392,6 +392,7 @@ export class DataResourceDataProvider implements IGridDataProvider {
|
||||
let rows = await this._queryRunner.getQueryRows(i, numRows, this._batchId, this._id);
|
||||
this.convertData(rows);
|
||||
}
|
||||
this.cellModel.sendChangeToNotebook(NotebookChangeType.CellOutputUpdated);
|
||||
}
|
||||
|
||||
private convertData(rows: ResultSetSubset): void {
|
||||
|
||||
Reference in New Issue
Block a user