Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
afullerx committed Jul 1, 2024
1 parent 1563a2d commit a0fdb67
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions nicegui/static/nicegui.js
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ function createApp(elements, options) {
console.log("reloading because handshake failed for clientId " + window.clientId);
window.location.reload();
} else if (!res.success && res.reason === "sync_failure") {
console.log("reloading because sync failed (see message_history_max)");
console.log("reloading because client could not be synchronized with the server");
window.location.reload();
}
document.getElementById("popup").ariaHidden = true;
Expand Down Expand Up @@ -361,14 +361,12 @@ function createApp(elements, options) {
sync: (msg) => {
if (msg.sync_id == window.socket.id) {
window.syncing = false;
const len = msg.history.length;
const history = msg.history;
for (let i = 0; i < len; i++) {
let message = history[i][1];
for (let i = 0; i < msg.history.length; i++) {
let message = msg.history[i][1];
if (message.message_id > window.lastMessageId) {
window.lastMessageId = message.message_id;
delete message.message_id;
messageHandlers[history[i][0]](message);
messageHandlers[msg.history[i][0]](message);
}
}
}
Expand Down

0 comments on commit a0fdb67

Please sign in to comment.