Skip to content

Commit

Permalink
Fix race condition in chat
Browse files Browse the repository at this point in the history
  • Loading branch information
cuom1999 committed Aug 13, 2024
1 parent 7406d08 commit 8cd7327
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions templates/chat/chat_js.html
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down

0 comments on commit 8cd7327

Please sign in to comment.