diff --git a/lib/screens/channel/chat/stores/chat_assets_store.dart b/lib/screens/channel/chat/stores/chat_assets_store.dart index c1ec05f7..2efd626c 100644 --- a/lib/screens/channel/chat/stores/chat_assets_store.dart +++ b/lib/screens/channel/chat/stores/chat_assets_store.dart @@ -290,6 +290,18 @@ abstract class ChatAssetsStoreBase with Store { await Future.wait(futures); } + /// Whether any shared chat participant assets have been merged in. + bool get hasLoadedSharedChatAssets => _loadedSharedChannelIds.isNotEmpty; + + /// Clears tracking of merged shared chat participant assets so that leaving + /// and later re-entering a shared chat session re-fetches cleanly. The caller + /// must re-fetch this channel's own assets afterwards (which replaces the + /// merged emote/badge maps). Must run within a MobX action. + void resetSharedChatAssets() { + _loadedSharedChannelIds.clear(); + sharedSevenTvSetIds.clear(); + } + /// Load and cache shared chat participants for a broadcaster. /// Returns the list of new participant broadcaster IDs (deduped). @action diff --git a/lib/screens/channel/chat/stores/chat_store.dart b/lib/screens/channel/chat/stores/chat_store.dart index ccc93d6c..4ed851ea 100644 --- a/lib/screens/channel/chat/stores/chat_store.dart +++ b/lib/screens/channel/chat/stores/chat_store.dart @@ -611,6 +611,16 @@ abstract class ChatStoreBase with Store { showFFZEmotes: settings.showFFZEmotes, showFFZBadges: settings.showFFZBadges, ); + } else if (wasShared && + !_isInSharedChatMode && + assetsStore.hasLoadedSharedChatAssets) { + // On leaving shared chat, drop the participants' merged emotes and + // badges and restore just this channel's assets — otherwise the + // other streamer's emote set and badges linger (#522). Guarded on + // having actually loaded shared assets so a flapping tag can't + // trigger redundant refetches. + assetsStore.resetSharedChatAssets(); + getAssets(); } messageBuffer.add(parsedIRCMessage); break;