Skip to content

Commit 39d5c3b

Browse files
committed
doing a refresh only when the current session is the active session
1 parent 8f6d2e9 commit 39d5c3b

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

src/views/live-watch/live-watch.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,11 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
6969
const onDidChangeActiveDebugSession = tracker.onDidChangeActiveDebugSession(async (session) => await this.handleOnDidChangeActiveDebugSession(session));
7070
const onWillStartSession = tracker.onWillStartSession(async (session) => await this.handleOnWillStartSession(session));
7171
// Doing a refresh on pausing to ensure we have the latest data
72-
const onStopped = tracker.onStopped(async () => await this.refresh());
72+
const onStopped = tracker.onStopped(async (event) => {
73+
if (this._activeSession?.session.id === event.session.session.id) {
74+
await this.refresh();
75+
}
76+
});
7377
// Using this event because this is when the threadId is available for evaluations
7478
const onStackTrace = tracker.onDidChangeActiveStackItem(async () => await this.refresh());
7579
// Clearing active session on closing the session
@@ -97,14 +101,16 @@ export class LiveWatchTreeDataProvider implements vscode.TreeDataProvider<LiveWa
97101
}
98102

99103
private async handleOnDidChangeActiveDebugSession(session: GDBTargetDebugSession | undefined): Promise<void> {
100-
this._activeSession = session;
101-
await this.refresh();
104+
if (this._activeSession?.session.id === session?.session.id) {
105+
await this.refresh();
106+
}
102107
}
103108

104109
private async handleOnWillStartSession(session: GDBTargetDebugSession): Promise<void> {
105110
session.refreshTimer.onRefresh(async (refreshSession) => {
106-
this._activeSession = refreshSession;
107-
await this.refresh();
111+
if (this._activeSession?.session.id === refreshSession.session.id) {
112+
await this.refresh();
113+
}
108114
});
109115
}
110116

0 commit comments

Comments
 (0)