Conversation
There was a problem hiding this comment.
Pull request overview
This PR aims to ensure that when a new pending session is assigned to the local folder picker, the session’s repository URI is initialized from the picker’s already-selected folder (e.g., restored from storage), so the new session starts with the correct repo context.
Changes:
- Update
FolderPicker.setNewSessionto callsession.setRepoUri(...)when a folder is already selected. - Ensure repo selection is propagated even if the folder was chosen before the new session object existed.
| setNewSession(session: INewSession | undefined): void { | ||
| this._newSession = session; | ||
| if (session && this._selectedFolderUri) { | ||
| session.setRepoUri(this._selectedFolderUri); |
There was a problem hiding this comment.
Calling session.setRepoUri(this._selectedFolderUri) here will run INewSession.setRepoUri, which for LocalNewSession also forces isolationMode to 'workspace' and clears branch. Since new sessions are already created with defaultRepoUri (see createNewSessionForTarget(..., defaultRepoUri)), this can unnecessarily overwrite the session’s initial state and duplicate option notifications. Consider guarding this call (e.g., only set when session.repoUri is undefined or different) so wiring the picker doesn’t mutate the session when it’s already initialized.
| session.setRepoUri(this._selectedFolderUri); | |
| const currentRepoUri = session.repoUri; | |
| if (!currentRepoUri || !isEqual(currentRepoUri, this._selectedFolderUri)) { | |
| session.setRepoUri(this._selectedFolderUri); | |
| } |
No description provided.