Matthias Nott
2026-03-24 b80f8465a6b71167b215fb1d582eaefdd9a88a1d
lib/screens/chat_screen.dart
....@@ -218,6 +218,7 @@
218218 final typing = msg['typing'] as bool? ?? msg['isTyping'] as bool? ?? msg['active'] as bool? ?? true;
219219 final typingSession = msg['sessionId'] as String?;
220220 final activeId = ref.read(activeSessionIdProvider);
221
+ _chatLog('TYPING: session=${typingSession?.substring(0, 8)} active=${activeId?.substring(0, 8)} typing=$typing match=${typingSession == activeId}');
221222 // Strict: only show typing for the ACTIVE session, ignore all others
222223 if (activeId != null && typingSession == activeId) {
223224 ref.read(isTypingProvider.notifier).state = typing;
....@@ -620,10 +621,11 @@
620621 }
621622
622623 Future<void> _switchSession(String sessionId) async {
623
- // Stop any playing audio and dismiss keyboard when switching sessions
624
+ // Stop any playing audio, dismiss keyboard, and clear typing indicator
624625 await AudioService.stopPlayback();
625626 setState(() => _playingMessageId = null);
626627 if (mounted) FocusScope.of(context).unfocus();
628
+ ref.read(isTypingProvider.notifier).state = false;
627629
628630 ref.read(activeSessionIdProvider.notifier).state = sessionId;
629631 await ref.read(messagesProvider.notifier).switchSession(sessionId);