Skip to content

Commit 6ec5e7b

Browse files
authored
debug: fix tree 'measuring node not in DOM error' (microsoft#236645)
1 parent ad359b1 commit 6ec5e7b

File tree

1 file changed

+26
-14
lines changed
  • src/vs/workbench/contrib/debug/browser

1 file changed

+26
-14
lines changed

src/vs/workbench/contrib/debug/browser/repl.ts

Lines changed: 26 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,11 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget {
174174
this.onDidFocusSession(this.debugService.getViewModel().focusedSession);
175175
}
176176

177-
this._register(this.debugService.getViewModel().onDidFocusSession(async session => this.onDidFocusSession(session)));
177+
this._register(this.debugService.getViewModel().onDidFocusSession(session => {
178+
if (this.isVisible()) {
179+
this.onDidFocusSession(session);
180+
}
181+
}));
178182
this._register(this.debugService.getViewModel().onDidEvaluateLazyExpression(async e => {
179183
if (e instanceof Variable && this.tree?.hasNode(e)) {
180184
await this.tree.updateChildren(e, false, true);
@@ -201,19 +205,27 @@ export class Repl extends FilterViewPane implements IHistoryNavigationWidget {
201205
}
202206
}));
203207
this._register(this.onDidChangeBodyVisibility(visible => {
204-
if (visible) {
205-
if (!this.model) {
206-
this.model = this.modelService.getModel(Repl.URI) || this.modelService.createModel('', null, Repl.URI, true);
207-
}
208-
this.setMode();
209-
this.replInput.setModel(this.model);
210-
this.updateInputDecoration();
211-
this.refreshReplElements(true);
212-
if (this.styleChangedWhenInvisible) {
213-
this.styleChangedWhenInvisible = false;
214-
this.tree?.updateChildren(undefined, true, false);
215-
this.onDidStyleChange();
216-
}
208+
if (!visible) {
209+
return;
210+
}
211+
if (!this.model) {
212+
this.model = this.modelService.getModel(Repl.URI) || this.modelService.createModel('', null, Repl.URI, true);
213+
}
214+
215+
const focusedSession = this.debugService.getViewModel().focusedSession;
216+
if (this.tree && this.tree.getInput() !== focusedSession) {
217+
this.onDidFocusSession(focusedSession);
218+
}
219+
220+
this.setMode();
221+
this.replInput.setModel(this.model);
222+
this.updateInputDecoration();
223+
this.refreshReplElements(true);
224+
225+
if (this.styleChangedWhenInvisible) {
226+
this.styleChangedWhenInvisible = false;
227+
this.tree?.updateChildren(undefined, true, false);
228+
this.onDidStyleChange();
217229
}
218230
}));
219231
this._register(this.configurationService.onDidChangeConfiguration(e => {

0 commit comments

Comments
 (0)