sessions: header changes pill opens the default changeset (#323139)

The pill label shows the session's default changeset, but activating it opened
the shared per-session diff editor, which follows the Changes view's currently
selected changeset. After a manual selection the label and the opened diff
could disagree.

Reset the Changes view selection to the default before opening so the pill, the
diff editor, and the Changes view panel all reflect the default changeset.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Sandeep Somavarapu
2026-06-26 16:48:43 +02:00
committed by GitHub
parent 810c165747
commit fc9f104274

View File

@@ -22,6 +22,7 @@ import { SessionHasChangesContext } from '../../../common/contextkeys.js';
import { ISessionContext } from '../../../services/sessions/browser/sessionContext.js';
import { ISessionsService } from '../../../services/sessions/browser/sessionsService.js';
import { IActiveSession } from '../../../services/sessions/common/sessionsManagement.js';
import { IChangesViewService } from '../common/changesViewService.js';
import { ChangesMultiDiffSourceResolver } from './changesMultiDiffSourceResolver.js';
import { ISessionChangesService } from './sessionChangesService.js';
@@ -52,6 +53,7 @@ class ViewAllChangesAction extends Action2 {
const editorService = accessor.get(IEditorService);
const sessionsService = accessor.get(ISessionsService);
const sessionChangesService = accessor.get(ISessionChangesService);
const changesViewService = accessor.get(IChangesViewService);
// The clicked session is forwarded as the argument by the session header,
// which has already promoted it to be the active session. Fall back to the
@@ -61,6 +63,11 @@ class ViewAllChangesAction extends Action2 {
return;
}
// The header pill reflects the session's default changeset, so reset any
// Changes-view selection to the default before opening so the diff editor
// (a shared per-session resource) shows the same changes as the pill.
changesViewService.setChangesetId(undefined);
// Open the multi-file diff editor in the editor part. The resource list is
// resolved reactively via the `ChangesMultiDiffSourceResolver` registered as
// a workbench contribution.