fix: improve chat message deduplication, add conversation refresh logic, and update UI components for consistency
This commit is contained in:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user