mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-16 18:46:40 -05:00
Detect when resultset length changes and force buffer recreation (#5522)
This commit is contained in:
@@ -78,6 +78,7 @@ export class VirtualizedCollection<T extends Slick.SlickData> implements IObserv
|
|||||||
private _bufferWindowBefore: DataWindow<T>;
|
private _bufferWindowBefore: DataWindow<T>;
|
||||||
private _window: DataWindow<T>;
|
private _window: DataWindow<T>;
|
||||||
private _bufferWindowAfter: DataWindow<T>;
|
private _bufferWindowAfter: DataWindow<T>;
|
||||||
|
private _lengthChanged = false;
|
||||||
|
|
||||||
private collectionChangedCallback: (startIndex: number, count: number) => void;
|
private collectionChangedCallback: (startIndex: number, count: number) => void;
|
||||||
|
|
||||||
@@ -113,7 +114,10 @@ export class VirtualizedCollection<T extends Slick.SlickData> implements IObserv
|
|||||||
}
|
}
|
||||||
|
|
||||||
setLength(length: number): void {
|
setLength(length: number): void {
|
||||||
this.length = length;
|
if (this.length !== length) {
|
||||||
|
this._lengthChanged = true;
|
||||||
|
this.length = length;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public at(index: number): T {
|
public at(index: number): T {
|
||||||
@@ -126,8 +130,9 @@ export class VirtualizedCollection<T extends Slick.SlickData> implements IObserv
|
|||||||
let currentData = this.getRangeFromCurrent(start, end);
|
let currentData = this.getRangeFromCurrent(start, end);
|
||||||
|
|
||||||
// only shift window and make promise of refreshed data in following condition:
|
// 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
|
// jump, reset
|
||||||
|
this._lengthChanged = false;
|
||||||
this.resetWindowsAroundIndex(start);
|
this.resetWindowsAroundIndex(start);
|
||||||
} else if (end <= this._bufferWindowBefore.getEndIndex()) {
|
} else if (end <= this._bufferWindowBefore.getEndIndex()) {
|
||||||
// scroll up, shift up
|
// scroll up, shift up
|
||||||
|
|||||||
Reference in New Issue
Block a user