From 0c715d8646fc27774f6ba0a073de8e4dc246d9d3 Mon Sep 17 00:00:00 2001 From: Tommy Chow Date: Thu, 2 Jul 2026 23:54:36 -0400 Subject: [PATCH] fix(chat): don't spotlight a hidden shared-chat bubble MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit toggleFocus didn't check hiddenChannelIds, so tapping a hidden bubble's chip added it to the spotlight set — fading every other participant to showcase a channel whose own messages were already filtered out of the feed. --- .../channel/chat/stores/shared_chat_bubble_state.dart | 5 ++++- .../screens/channel/chat/shared_chat_bubble_state_test.dart | 6 ++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/lib/screens/channel/chat/stores/shared_chat_bubble_state.dart b/lib/screens/channel/chat/stores/shared_chat_bubble_state.dart index 825c3ed4..6d18c655 100644 --- a/lib/screens/channel/chat/stores/shared_chat_bubble_state.dart +++ b/lib/screens/channel/chat/stores/shared_chat_bubble_state.dart @@ -14,8 +14,11 @@ class SharedChatBubbleState { /// Channel ids whose messages are filtered out of the feed entirely. final hiddenChannelIds = ObservableSet(); - /// Adds/removes [channelId] from the spotlight set. + /// Adds/removes [channelId] from the spotlight set. No-ops for a hidden + /// channel — its messages are filtered out, so spotlighting it would fade + /// every other channel to showcase nothing. void toggleFocus(String channelId) { + if (hiddenChannelIds.contains(channelId)) return; if (!focusedChannelIds.remove(channelId)) { focusedChannelIds.add(channelId); } diff --git a/test/screens/channel/chat/shared_chat_bubble_state_test.dart b/test/screens/channel/chat/shared_chat_bubble_state_test.dart index 7c12a727..65a2b927 100644 --- a/test/screens/channel/chat/shared_chat_bubble_state_test.dart +++ b/test/screens/channel/chat/shared_chat_bubble_state_test.dart @@ -35,6 +35,12 @@ void main() { expect(state.isFocused('1'), isFalse); }); + test('toggleFocus is a no-op for a hidden channel', () { + state.hide('1'); + state.toggleFocus('1'); + expect(state.isFocused('1'), isFalse); + }); + test('show lifts a hide', () { state.hide('1'); state.show('1');