MCPcopy
hub / github.com/stravu/crystal / setActiveSession

Method setActiveSession

main/src/services/gitStatusManager.ts:80–104  ·  view source on GitHub ↗

* Set the currently active session for smart polling

(sessionId: string | null)

Source from the content-addressed store, hash-verified

78 * Set the currently active session for smart polling
79 */
80 setActiveSession(sessionId: string | null): void {
81 const previousActive = this.activeSessionId;
82 this.activeSessionId = sessionId;
83
84 if (previousActive !== sessionId) {
85 console.log(`[GitStatus] Active session changed from ${previousActive} to ${sessionId}`);
86
87 // Start watching the active session's files if we have one
88 if (sessionId) {
89 this.startWatchingSession(sessionId);
90
91 // If window is visible, also refresh immediately
92 if (this.isWindowVisible) {
93 this.refreshSessionGitStatus(sessionId, false).catch(error => {
94 console.warn(`[GitStatus] Failed to refresh active session ${sessionId}:`, error);
95 });
96 }
97 }
98
99 // Stop watching the previous active session if it exists
100 if (previousActive) {
101 this.stopWatchingSession(previousActive);
102 }
103 }
104 }
105
106 /**
107 * Start file watching for a session

Callers 9

handleDeleteFolderFunction · 0.80
DraggableProjectTreeViewFunction · 0.80
handleSessionClickFunction · 0.80
openMainRepoSessionFunction · 0.80
getMainRepoSessionFunction · 0.80
handleSelectAndViewDiffFunction · 0.80
archiveSingleSessionFunction · 0.80
registerSessionHandlersFunction · 0.80

Calls 5

startWatchingSessionMethod · 0.95
stopWatchingSessionMethod · 0.95
warnMethod · 0.80
logMethod · 0.45

Tested by

no test coverage detected