* Set the currently active session for smart polling
(sessionId: string | null)
| 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 |
no test coverage detected