fix removing message from thread
This commit is contained in:
@@ -10,6 +10,8 @@
|
||||
- [[#890]](https://github.com/GetStream/stream-chat-flutter/pull/890) Fixed Reactions not updating on thread messages.
|
||||
Thanks [bstolinski](https://github.com/bstolinski).
|
||||
- [[#897]](https://github.com/GetStream/stream-chat-flutter/issues/897) Fixed error type mis-match in `AuthInterceptor`.
|
||||
- [[#891]](https://github.com/GetStream/stream-chat-flutter/pull/891). Fixed reply counter for parent message not
|
||||
updating correctly after deleting thread message.
|
||||
|
||||
## 3.4.0
|
||||
|
||||
|
||||
@@ -1826,11 +1826,19 @@ class ChannelClientState {
|
||||
final parentId = message.parentId;
|
||||
// i.e. it's a thread message, Remove it
|
||||
if (parentId != null) {
|
||||
final threadMessages = [...threads[parentId]!];
|
||||
return updateThreadInfo(
|
||||
parentId,
|
||||
threadMessages..removeWhere((e) => e.id == message.id),
|
||||
);
|
||||
if (!threads.containsKey(parentId)) {
|
||||
return;
|
||||
}
|
||||
|
||||
final newThreads = Map<String, List<Message>>.from(threads);
|
||||
|
||||
newThreads[parentId] = [
|
||||
...newThreads[parentId]!
|
||||
..removeWhere((e) => e.id == message.id),
|
||||
];
|
||||
|
||||
_threads = newThreads;
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove regular message
|
||||
|
||||
Reference in New Issue
Block a user