Commit
·
0b80042
1
Parent(s):
c768d09
Add debug logs for Session click issue
Browse files
frontend/src/hooks/useChat.ts
CHANGED
|
@@ -43,7 +43,8 @@ export function useChat(options: UseChatOptions = {}) {
|
|
| 43 |
console.log('useChat - currentSession updated:', {
|
| 44 |
sessionId: currentSessionId,
|
| 45 |
found: !!session,
|
| 46 |
-
messageCount: session?.messages?.length || 0
|
|
|
|
| 47 |
})
|
| 48 |
return session
|
| 49 |
}, [sessions, currentSessionId])
|
|
@@ -89,8 +90,10 @@ export function useChat(options: UseChatOptions = {}) {
|
|
| 89 |
|
| 90 |
// Switch to session
|
| 91 |
const selectSession = useCallback((sessionId: string) => {
|
|
|
|
| 92 |
setCurrentSessionId(sessionId)
|
| 93 |
chatStorage.setCurrentSession(sessionId)
|
|
|
|
| 94 |
}, [])
|
| 95 |
|
| 96 |
// Delete session
|
|
|
|
| 43 |
console.log('useChat - currentSession updated:', {
|
| 44 |
sessionId: currentSessionId,
|
| 45 |
found: !!session,
|
| 46 |
+
messageCount: session?.messages?.length || 0,
|
| 47 |
+
sessionTitle: session?.title || 'No session'
|
| 48 |
})
|
| 49 |
return session
|
| 50 |
}, [sessions, currentSessionId])
|
|
|
|
| 90 |
|
| 91 |
// Switch to session
|
| 92 |
const selectSession = useCallback((sessionId: string) => {
|
| 93 |
+
console.log('selectSession called with:', sessionId)
|
| 94 |
setCurrentSessionId(sessionId)
|
| 95 |
chatStorage.setCurrentSession(sessionId)
|
| 96 |
+
console.log('currentSessionId updated to:', sessionId)
|
| 97 |
}, [])
|
| 98 |
|
| 99 |
// Delete session
|
frontend/src/pages/Playground.tsx
CHANGED
|
@@ -351,7 +351,10 @@ export function Playground() {
|
|
| 351 |
className={`p-3 cursor-pointer transition-colors hover:bg-accent ${
|
| 352 |
currentSessionId === session.id ? 'bg-accent border-primary' : ''
|
| 353 |
}`}
|
| 354 |
-
onClick={() =>
|
|
|
|
|
|
|
|
|
|
| 355 |
>
|
| 356 |
<div className="flex items-center justify-between">
|
| 357 |
<span className="text-sm font-medium truncate">{session.title}</span>
|
|
|
|
| 351 |
className={`p-3 cursor-pointer transition-colors hover:bg-accent ${
|
| 352 |
currentSessionId === session.id ? 'bg-accent border-primary' : ''
|
| 353 |
}`}
|
| 354 |
+
onClick={() => {
|
| 355 |
+
console.log('Session card clicked:', session.id, session.title)
|
| 356 |
+
selectSession(session.id)
|
| 357 |
+
}}
|
| 358 |
>
|
| 359 |
<div className="flex items-center justify-between">
|
| 360 |
<span className="text-sm font-medium truncate">{session.title}</span>
|