mirror of
https://github.com/readest/readest.git
synced 2026-07-09 16:00:16 +00:00
READEST-2 (Maximum update depth exceeded) was still firing on 0.11.18 despite the
updateTransferProgress no-op guard, because the guard compared transferSpeed,
which webDownload/webUpload recompute from wall-clock time on every chunk, so it
essentially never matched. Indeterminate downloads (R2/S3 signed URLs without
Content-Length -> total=0) churn per chunk too. webDownload drains the stream
with `while (true) { await reader.read(); onProgress(...) }`, so a buffered
source fires the whole burst in one macrotask and the transfer-store fan-out
(the reader subscribes via useTransferQueue) blows past React's nested-update
limit.
- Add createProgressThrottle (leading + trailing, macrotask trailing edge) and
route every transfer's progress through it in executeTransfer, capping store
writes at ~10/sec per transfer; flush the final value on completion, cancel on
teardown.
- Drop transferSpeed from the store's no-op equality so the guard can fire on
duplicate/stalled progress.
Adds unit tests for the throttle (burst coalescing, flush, cancel) and the
speed-only no-op.
Fixes READEST-2
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
||
|---|---|---|
| .. | ||
| readest-app | ||
| readest-calibre-plugin | ||
| readest.koplugin | ||