Fix race condition in chat

This commit is contained in:
cuom1999 2024-08-13 17:57:05 +07:00
parent 7406d081aa
commit 8cd7327d20

View file

@ -141,8 +141,11 @@
message: message,
},
success: function (data) {
add_message(data);
callback(true);
// make sure user is still in the same room
if (room == window.room_id) {
add_message(data);
callback(true);
}
},
error: function (data) {
console.log('Could not add new message');