fix: use upload and download abort signals (#212)

* fix: use upload and download abort signals

* fix: progress trackers

chore: update fm-lib and bee-js

* chore: bump-up fm-lib version
This commit is contained in:
Bálint Ujvári
2026-03-05 16:55:09 +01:00
parent e00918b192
commit 308ec3dcc0
13 changed files with 154 additions and 85 deletions
@@ -8,7 +8,7 @@ import { uuidV4 } from '../../../utils'
import { DownloadProgress, TrackDownloadProps } from '../constants/transfers'
import { getUsableStamps } from '../utils/bee'
import { formatBytes, getFileId, safeSetState } from '../utils/common'
import { startDownloadingQueue } from '../utils/download'
import { FileInfoWithUUID, startDownloadingQueue } from '../utils/download'
import { FileOperation, performBulkFileOperation } from '../utils/fileOperations'
interface BulkOptions {
@@ -77,23 +77,28 @@ export function useBulkActions({ listToRender, setErrorMessage, trackDownload }:
async (list: FileInfo[]) => {
if (!fm || !list?.length) return
const trackers: Array<(progress: DownloadProgress) => void> = []
for (const fi of list) {
const trackers = new Array<(progress: DownloadProgress) => void>(list.length)
const infoListWitIDs: FileInfoWithUUID[] = new Array<FileInfoWithUUID>(list.length)
for (let i = 0; i < list.length; i++) {
const fi = list[i]
const rawSize = fi.customMetadata?.size as string | number | undefined
const prettySize = formatBytes(rawSize)
const expected = rawSize ? Number(rawSize) : undefined
const driveName = drives.find(d => d.id.toString() === fi.driveId.toString())?.name
const tracker = trackDownload({
uuid: uuidV4(),
const uuid = uuidV4()
infoListWitIDs[i] = { uuid, info: fi }
trackers[i] = trackDownload({
uuid,
name: fi.name,
size: prettySize,
expectedSize: expected,
driveName,
})
trackers.push(tracker)
}
await startDownloadingQueue(fm, list, trackers)
await startDownloadingQueue(fm, infoListWitIDs, trackers)
},
[fm, trackDownload, drives],
)