From f80bd39a62efd6862bd96a836524184245088adc Mon Sep 17 00:00:00 2001
From: Matthias Nott <mnott@mnsoft.org>
Date: Tue, 24 Mar 2026 08:59:32 +0100
Subject: [PATCH] fix: strict per-session typing - no null fallthrough, explicit match only

---
 lib/screens/chat_screen.dart |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/lib/screens/chat_screen.dart b/lib/screens/chat_screen.dart
index 0423ec9..e51c227 100644
--- a/lib/screens/chat_screen.dart
+++ b/lib/screens/chat_screen.dart
@@ -218,13 +218,14 @@
         final typing = msg['typing'] as bool? ?? msg['isTyping'] as bool? ?? msg['active'] as bool? ?? true;
         final typingSession = msg['sessionId'] as String?;
         final activeId = ref.read(activeSessionIdProvider);
-        // Only show typing indicator for the active session
-        if (typingSession == null || typingSession == activeId) {
+        // Strict: only show typing for the ACTIVE session, ignore all others
+        if (activeId != null && typingSession == activeId) {
           ref.read(isTypingProvider.notifier).state = typing;
         }
       case 'typing_end':
         final endSession = msg['sessionId'] as String?;
-        if (endSession == null || endSession == ref.read(activeSessionIdProvider)) {
+        final activeEndId = ref.read(activeSessionIdProvider);
+        if (activeEndId != null && endSession == activeEndId) {
           ref.read(isTypingProvider.notifier).state = false;
         }
       case 'screenshot':

--
Gitblit v1.3.1