Chat: an unchecked earlier send no longer flashes 'Not sent' on open

A message a previous visit sent but never saw acknowledged was restored as
'Not sent' and flipped to sent a moment later, once the history read showed
the server had it. It now stays 'sending' until that read, and only becomes
'Not sent' if the server really does not have it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
2026-12-02 16:48:13 +00:00
parent 7d7d839ffa
commit c441400f36
2 changed files with 42 additions and 1 deletions
@@ -243,7 +243,10 @@ class ChatDeliveries extends ChangeNotifier {
for (final intent in intents) {
if (_states.containsKey(intent.operationId)) continue;
_remember(intent);
_states[intent.operationId] = ChatDelivery.failed;
// Unchecked, not failed: it shows as sending until [reconcile] has read
// the transcript, so a message the server did record never flashes
// "Not sent" while the chat opens.
_states[intent.operationId] = ChatDelivery.sending;
_unverified.add(intent);
changed = true;
}
@@ -264,6 +267,11 @@ class ChatDeliveries extends ChangeNotifier {
for (final intent in confirmed) {
_states[intent.operationId] = ChatDelivery.sent;
}
for (final intent in _unverified) {
if (!confirmed.contains(intent)) {
_states[intent.operationId] = ChatDelivery.failed;
}
}
_unsent.removeWhere(confirmed.contains);
_unverified.removeWhere(confirmed.contains);
_unsent.addAll(_unverified);