git » sdk » commit 05abbf4

chat might not match object identity

author Stephen Paul Weber
2025-11-23 19:52:53 UTC
committer Stephen Paul Weber
2025-11-23 19:52:53 UTC
parent 37e50c4da9d66270216a2add5db4368cc91a2a94

chat might not match object identity

Especially if passed as a Proxy from the front-end

borogove/Client.hx +1 -1

diff --git a/borogove/Client.hx b/borogove/Client.hx
index 30c5ffc..2a949e8 100644
--- a/borogove/Client.hx
+++ b/borogove/Client.hx
@@ -1438,7 +1438,7 @@ class Client extends EventEmitter {
 			persistence.storeChats(accountId(), [chat]);
 		}
 		final pinnedCount = chat.uiState == Pinned ? 0 : chats.fold((item, result) -> result + (item.uiState == Pinned ? 1 : 0), 0);
-		var idx = chats.indexOf(chat);
+		var idx = chats.findIndex(c -> c.chatId == chat.chatId);
 		if (idx > pinnedCount) {
 			chats.splice(idx, 1);
 			chats.insert(pinnedCount, chat);