diff --git a/src/sql/workbench/parts/query/browser/messagePanel.ts b/src/sql/workbench/parts/query/browser/messagePanel.ts index d15299d29f..ec08b694e2 100644 --- a/src/sql/workbench/parts/query/browser/messagePanel.ts +++ b/src/sql/workbench/parts/query/browser/messagePanel.ts @@ -199,9 +199,10 @@ export class MessagePanel extends Disposable { // convert to old VS Code tree interface with expandable methods let expandableTree: IExpandableTree = this.tree; if (this.state.scrollPosition) { + const previousScroll = this.state.scrollPosition; this.tree.refresh(this.model).then(() => { // Restore the previous scroll position when switching between tabs - expandableTree.setScrollPosition(this.state.scrollPosition); + expandableTree.setScrollPosition(previousScroll); }); } else { const previousScrollPosition = expandableTree.getScrollPosition();