fix: clear file progress on completion in daemon mode
file_complete in daemon mode carries transfer_id but no offer field. The old condition required msg.offer, so the progress/cancel row was never removed. Now clears using transfer_id first, offer.xid as fallback. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -347,10 +347,13 @@ export const useWaste = create<WasteState>((set, get) => ({
|
||||
break
|
||||
}
|
||||
case 'file_complete': {
|
||||
if (msg.path && msg.offer?.name) {
|
||||
// clear progress entry
|
||||
const xid = msg.offer.xid
|
||||
// Always clear progress — transfer_id is the xid in daemon mode; offer.xid in browser mode.
|
||||
const xid = msg.transfer_id ?? msg.offer?.xid
|
||||
if (xid) {
|
||||
set(s => { const fp = { ...s.fileProgress }; delete fp[xid]; return { fileProgress: fp } })
|
||||
}
|
||||
// Browser mode: trigger download via anchor click.
|
||||
if (msg.path && msg.offer?.name) {
|
||||
const a = document.createElement('a')
|
||||
a.href = msg.path
|
||||
a.download = msg.offer.name
|
||||
|
||||
Reference in New Issue
Block a user