mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-07-13 13:21:21 +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:
+5
-4
@@ -601,21 +601,22 @@ def send_message():
|
||||
channel_idx = data.get('channel_idx', 0)
|
||||
|
||||
# Send message via meshcli
|
||||
success, message, msg_id = cli.send_message(text, reply_to=reply_to, channel_index=channel_idx)
|
||||
result = cli.send_message(text, reply_to=reply_to, channel_index=channel_idx)
|
||||
|
||||
if success:
|
||||
if result['success']:
|
||||
# v2: Echo tracking is handled automatically by DeviceManager events
|
||||
|
||||
return jsonify({
|
||||
'success': True,
|
||||
'message': 'Message sent successfully',
|
||||
'channel_idx': channel_idx,
|
||||
'id': msg_id,
|
||||
'id': result.get('id'),
|
||||
'timestamp': result.get('timestamp'),
|
||||
}), 200
|
||||
else:
|
||||
return jsonify({
|
||||
'success': False,
|
||||
'error': message
|
||||
'error': result.get('error', 'Failed to send message')
|
||||
}), 500
|
||||
|
||||
except Exception as e:
|
||||
|
||||
Reference in New Issue
Block a user