Fix duplicate messages arriving through websocket
This commit is contained in:
parent
f6310d3065
commit
dc5db6aac6
5 changed files with 24 additions and 24 deletions
13
js/utils.js
13
js/utils.js
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue