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

Function getMainRepoSession

frontend/src/components/ProjectView.tsx:213–236  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

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]);

Callers 1

ProjectViewFunction · 0.85

Calls 3

setActiveSessionMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected