Fix duplicate messages arriving through websocket

This commit is contained in:
天クマ 2026-07-16 22:35:15 -03:00
commit dc5db6aac6
5 changed files with 24 additions and 24 deletions

View file

@ -99,4 +99,17 @@ export function getBase64(file) {
reader.readAsDataURL(file);
});
}
/**
* Normalize a WhatsApp ID (chatId, messageId, etc.) to its string representation
* @param {string|object} raw
* @returns {string|null}
*/
export function normalizeId(raw) {
if (!raw) return null;
if (typeof raw === 'object') {
return raw._serialized || raw.user || JSON.stringify(raw);
}
return raw;
}