fix(web): in-session pause/resume preserves File ref; aborted transfers flip bubble to failed

This commit is contained in:
Jannis Braun
2026-05-02 18:03:12 +02:00
parent 403c6e9075
commit a58b7459fb
3 changed files with 44 additions and 5 deletions
@@ -43,6 +43,23 @@ export function startPendingMessageOrchestrator(): void {
if (sig === lastStateSig) return;
lastStateSig = sig;
// Mark bubbles as 'failed' when any of their transfers are in a terminal-failure
// state (aborted or failed). This surfaces the retry/discard row in Message.tsx
// instead of leaving the bubble stuck in 'sending' forever.
const allTransfers = useTransferStore.getState().transfers;
for (const list of usePendingMessageStore.getState().bubbles.values()) {
for (const b of list) {
if (b.state !== 'sending') continue;
const anyBad = b.transferIds.some((tid) => {
const t = allTransfers.get(tid);
return t && (t.state === 'failed' || t.state === 'aborted');
});
if (anyBad) {
usePendingMessageStore.getState().markFailed(b.clientId);
}
}
}
const fresh = usePendingMessageStore.getState().listReadyForDeferredSend();
for (const b of fresh) {
if (!sentClientIds.has(b.clientId)) {