fix(web): retry-after-abort starts fresh tus session; preserve File past abort

This commit is contained in:
Jannis Braun
2026-05-02 18:18:07 +02:00
parent 61dea725a3
commit dd91f5f349
4 changed files with 77 additions and 29 deletions
+8 -5
View File
@@ -522,13 +522,16 @@ export function Message({ message, isCompact, isFirstInGroup, previousMessageId
<button
onClick={async () => {
const transfers = useTransferStore.getState().transfers;
const failedIds = pending.transferIds.filter(
(tid) => transfers.get(tid)?.state === 'failed',
);
for (const tid of failedIds) {
const retryIds = pending.transferIds.filter((tid) => {
const s = transfers.get(tid)?.state;
return s === 'failed' || s === 'aborted';
});
// Flip the bubble back to 'sending' first so the orchestrator
// re-evaluates after the resumed transfers complete.
usePendingMessageStore.getState().markSending(pending.clientId);
for (const tid of retryIds) {
await useTransferStore.getState().resumeUpload(tid);
}
usePendingMessageStore.getState().markSending(pending.clientId);
}}
className="px-2 py-0.5 rounded-md text-[11.5px] font-medium text-accent-mint bg-accent-mint/10 hover:bg-accent-mint/20 transition-colors"
>
@@ -258,8 +258,11 @@ export function MessageInput({ channelId, channelName }: MessageInputProps) {
// bytes get cleaned by the storage janitor (per docs/systems/uploads.md).
useTransferStore.getState().remove(transferId);
} else {
// abortUpload sets state='aborted' and tears down the live tus instance.
// Tear down the live tus instance, then drop the transfer + free the
// retained File reference. (abortUpload alone leaves the record in the
// store for retry-after-abort; here the user is fully discarding.)
abortUpload(transferId);
useTransferStore.getState().remove(transferId);
}
removeStaged(channelId, transferId);
},