fix: stop image compression blocking the main thread #6
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "claw/compress-perf-d4e8"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #5. Follow-up to #3.
Picking a large image made the admin look like it had hung — overlay stuck on
Preparing…, bar at 0%, page unresponsive.Cause
Fix
Encoded size tracks pixel count closely at fixed quality, so the overshoot ratio from one attempt estimates the scale the next needs. That converges in 2–3 attempts (capped at 4) instead of walking a ladder. The loop yields between attempts so the UI can paint, and the preparing state now shows an indeterminate pulsing bar rather than a determinate 0%.
Measured
Quality is unaffected — the realistic photo still lands at full 2560×1920 (324 KB).
Re-verified end-to-end
Driven through the admin UI with Playwright against the real code:
npm run type-checkandnpm run buildclean.🤖 Generated with Claude Code