diff --git a/src/sql/base/browser/ui/table/asyncDataView.ts b/src/sql/base/browser/ui/table/asyncDataView.ts index d05775475c..16b5cb85f9 100644 --- a/src/sql/base/browser/ui/table/asyncDataView.ts +++ b/src/sql/base/browser/ui/table/asyncDataView.ts @@ -78,6 +78,7 @@ export class VirtualizedCollection implements IObserv private _bufferWindowBefore: DataWindow; private _window: DataWindow; private _bufferWindowAfter: DataWindow; + private _lengthChanged = false; private collectionChangedCallback: (startIndex: number, count: number) => void; @@ -113,7 +114,10 @@ export class VirtualizedCollection implements IObserv } setLength(length: number): void { - this.length = length; + if (this.length !== length) { + this._lengthChanged = true; + this.length = length; + } } public at(index: number): T { @@ -126,8 +130,9 @@ export class VirtualizedCollection implements IObserv let currentData = this.getRangeFromCurrent(start, end); // only shift window and make promise of refreshed data in following condition: - if (start < this._bufferWindowBefore.getStartIndex() || end > this._bufferWindowAfter.getEndIndex()) { + if (this._lengthChanged || start < this._bufferWindowBefore.getStartIndex() || end > this._bufferWindowAfter.getEndIndex()) { // jump, reset + this._lengthChanged = false; this.resetWindowsAroundIndex(start); } else if (end <= this._bufferWindowBefore.getEndIndex()) { // scroll up, shift up