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
|
break
|
||||||
}
|
}
|
||||||
case 'file_complete': {
|
case 'file_complete': {
|
||||||
if (msg.path && msg.offer?.name) {
|
// Always clear progress — transfer_id is the xid in daemon mode; offer.xid in browser mode.
|
||||||
// clear progress entry
|
const xid = msg.transfer_id ?? msg.offer?.xid
|
||||||
const xid = msg.offer.xid
|
if (xid) {
|
||||||
set(s => { const fp = { ...s.fileProgress }; delete fp[xid]; return { fileProgress: fp } })
|
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')
|
const a = document.createElement('a')
|
||||||
a.href = msg.path
|
a.href = msg.path
|
||||||
a.download = msg.offer.name
|
a.download = msg.offer.name
|
||||||
|
|||||||
Reference in New Issue
Block a user