mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-08-08 01:32:54 +02:00
fix(chat): prevent poll-triggered reload after send by using server timestamp
The 60s checkForUpdates poll was detecting has_updates due to clock skew between client and server timestamps. Now the send API returns the server timestamp, and the frontend uses it for markChannelAsRead — ensuring the poll sees no updates for own sent messages. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1325,6 +1325,10 @@ async function sendMessage() {
|
||||
const wrapper = document.querySelector(`.message-wrapper[data-msg-id="${optimisticId}"]`);
|
||||
if (wrapper) wrapper.dataset.msgId = data.id;
|
||||
}
|
||||
// Use server timestamp to prevent poll-triggered reload due to clock skew
|
||||
if (data.timestamp) {
|
||||
markChannelAsRead(currentChannelIdx, data.timestamp);
|
||||
}
|
||||
} else {
|
||||
showNotification('Failed to send: ' + data.error, 'danger');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user