()
| 211 | useEffect(() => { |
| 212 | // Create main repo session when component mounts to support panels |
| 213 | const getMainRepoSession = async () => { |
| 214 | setIsLoadingSession(true); |
| 215 | try { |
| 216 | const response = await API.sessions.getOrCreateMainRepoSession(projectId); |
| 217 | if (response.success && response.data) { |
| 218 | setMainRepoSessionId(response.data.id); |
| 219 | setMainRepoSession(response.data); |
| 220 | |
| 221 | // Subscribe to session updates |
| 222 | const sessions = useSessionStore.getState().sessions; |
| 223 | const mainSession = sessions.find(s => s.id === response.data.id); |
| 224 | if (mainSession) { |
| 225 | setMainRepoSession(mainSession); |
| 226 | } |
| 227 | |
| 228 | // Set as active session |
| 229 | useSessionStore.getState().setActiveSession(response.data.id); |
| 230 | } |
| 231 | } catch (error) { |
| 232 | console.error('Failed to get main repo session:', error); |
| 233 | } finally { |
| 234 | setIsLoadingSession(false); |
| 235 | } |
| 236 | }; |
| 237 | |
| 238 | getMainRepoSession(); |
| 239 | }, [projectId]); |
no test coverage detected