Skip to content

Commit 77f2e6e

Browse files
committed
Don't add the same message twice (and add a comment so I don't make this mistake a third time)
1 parent 8f0983b commit 77f2e6e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Signal-Windows/Controls/VirtualizedMessagesCollection.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public int Add(object value, bool hideUnreadMarker)
147147
LoadPage(pageIndex);
148148
}
149149
var cacheLine = MessageStorage[pageIndex];
150-
cacheLine.Add(message);
150+
cacheLine.Insert(inpageIndex, message); // If the page was loaded by LoadPage before, it already contains our message
151151
int virtualIndex = GetVirtualIndex(inConversationIndex);
152152
Logger.LogTrace("Add() Index={0} VirtualIndex={1}", inConversationIndex, virtualIndex);
153153
CollectionChanged?.Invoke(this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Add, message, virtualIndex));

0 commit comments

Comments
 (0)