@@ -133,9 +133,11 @@ jsaddleJs = "\
133133 \ var syncKey = \"\";\n\
134134 \\n\
135135 \ ws.onopen = function(e) {\n\
136− \ " <> initState <> "\
136+ \ " <> initState <> "\n\
137+ \ var inXhrSend = false;\n\
137138 \\n\
138139 \ ws.onmessage = function(e) {\n\
140+ \ if(inXhrSend) return;\n\
139141 \ var batch = JSON.parse(e.data);\n\
140142 \ if(typeof batch === \"string\") {\n\
141143 \ syncKey = batch;\n\
@@ -144,10 +146,12 @@ jsaddleJs = "\
144146 \\n\
145147 \ " <> runBatch (\a -> "ws.send(JSON.stringify(" <> a <> "));")
146148 (Just (\a -> "(function(){\n\
149+ \ inXhrSend = true;\n\
147150 \ var xhr = new XMLHttpRequest();\n\
148151 \ xhr.open('POST', '/sync/'+syncKey, false);\n\
149152 \ xhr.setRequestHeader(\"Content-type\", \"application/json\");\n\
150153 \ xhr.send(JSON.stringify(" <> a <> "));\n\
154+ \ inXhrSend = false;\n\
151155 \ return JSON.parse(xhr.response);})()")) <> "\
152156 \ };\n\
153157 \ };\n\