fix: improve chat message deduplication, add conversation refresh logic, and update UI components for consistency

This commit is contained in:
pradeepkumar
2026-04-18 11:34:48 +05:30
parent 164d590d31
commit afa1f3489a
6 changed files with 47 additions and 8 deletions

View File

@@ -333,7 +333,17 @@ class _SupportChatScreenState extends ConsumerState<SupportChatScreen> {
}
Widget _buildMessageArea(SupportChatState state, String currentUserId) {
final groups = _groupByDate(state.messages);
// Filter out any messages with empty content (phantom/blank cards)
// and deduplicate by ID (socket echo + REST response race condition)
final seen = <String>{};
final cleanMessages = <SupportMessage>[];
for (final msg in state.messages) {
if (msg.content.trim().isEmpty) continue;
if (seen.contains(msg.id)) continue;
seen.add(msg.id);
cleanMessages.add(msg);
}
final groups = _groupByDate(cleanMessages);
return Container(
color: const Color(0xFFF9F9F9),