fix: address CodeRabbitAI review comments for conversation history

- Fix duplicate onConversationCreated callbacks by tracking activeConversationId
- Fix history loss when switching conversations with Map-based deduplication
- Disable input while conversation is loading to prevent message routing issues
- Gate WebSocket debug logs behind DEV flag (import.meta.env.DEV)
- Downgrade server logging from info to debug level for reduced noise
- Fix .gitignore prefixes for playwright paths (ui/playwright-report/, ui/test-results/)
- Remove debug console.log from ConversationHistory.tsx
- Add staleTime (30s) to single conversation query for better caching
- Increase history message cap from 20 to 35 for better context
- Replace fixed timeouts with condition-based waits in e2e tests
This commit is contained in:
liri
2026-01-16 22:43:15 +00:00
parent 7d761cb8d0
commit c229e2b39b
8 changed files with 61 additions and 53 deletions

View File

@@ -120,7 +120,9 @@ export function useAssistantChat({
ws.onmessage = (event) => {
try {
const data = JSON.parse(event.data) as AssistantChatServerMessage;
console.log('[useAssistantChat] Received WebSocket message:', data.type, data);
if (import.meta.env.DEV) {
console.debug('[useAssistantChat] Received WebSocket message:', data.type, data);
}
switch (data.type) {
case "text": {
@@ -278,7 +280,9 @@ export function useAssistantChat({
payload.conversation_id = existingConversationId;
setConversationId(existingConversationId);
}
console.log('[useAssistantChat] Sending start message:', payload);
if (import.meta.env.DEV) {
console.debug('[useAssistantChat] Sending start message:', payload);
}
wsRef.current.send(JSON.stringify(payload));
} else if (wsRef.current?.readyState === WebSocket.CONNECTING) {
checkAndSendTimeoutRef.current = window.setTimeout(checkAndSend, 100);

View File

@@ -25,6 +25,7 @@ export function useConversation(projectName: string | null, conversationId: numb
queryKey: ['conversation', projectName, conversationId],
queryFn: () => api.getAssistantConversation(projectName!, conversationId!),
enabled: !!projectName && !!conversationId,
staleTime: 30_000, // Cache for 30 seconds
})
}