]> git.cworth.org Git - zombocom-ai/commitdiff
Fix replay of comments by putting them after replay of images
authorCarl Worth <cworth@cworth.org>
Thu, 8 Dec 2022 08:44:29 +0000 (00:44 -0800)
committerCarl Worth <cworth@cworth.org>
Thu, 8 Dec 2022 08:44:29 +0000 (00:44 -0800)
Since the elements we want to append comments to are only created by
the images.

index.js

index 11fac962fa3a4955c721f11c19f887718fbe55dd..55e17982786b27ad39ce47568dfe13cf18a39e02 100644 (file)
--- a/index.js
+++ b/index.js
@@ -77,12 +77,12 @@ io.on('connection', (socket) => {
 
     // Replay old comments and images to a newly-joining client
     socket.emit('reset');
-    state.comments.forEach((comment) => {
-        socket.emit('comment', comment)
-    });
     state.images.forEach((image) => {
         socket.emit('image', image)
     });
+    state.comments.forEach((comment) => {
+        socket.emit('comment', comment)
+    });
 
     socket.on('set-name', (name) => {
         console.log("Received set-name event: " + name);