optimize-image-upload-pipeline
rg "compression|preview|signed url|retry" src/features/uploads
The slow path starts before the image preview renders, so the UI waits on compression even when the original file could be shown immediately.
src/features/uploads/image-upload.pipeline.ts+94-12
src/features/uploads/upload-preview.tsx+37-2
I'm separating optimistic preview rendering from optimization so the original image can paint immediately while background work continues.
src/features/uploads/upload-dropzone.tsx+48-4
src/features/uploads/api/create-upload-url.ts+22
The queue now creates an optimistic preview immediately, then waits for worker metadata before swapping in the optimized asset.
Createdsrc/features/uploads/image-compression.worker.ts+103-0
I moved the CPU-heavy compression work into a dedicated worker and kept the selected image state in the main upload flow.
Createdsrc/features/uploads/upload-retry-boundary.ts+57-0
I added retry boundaries around signed URL creation so failed uploads can restart without losing the selected image.
Deletedsrc/features/uploads/upload-worker.ts-51
The legacy upload worker duplicated retry orchestration and kept stale blob references alive, so I removed it and folded the remaining state transitions into the pipeline.
Createdsrc/features/uploads/image-upload.pipeline.spec.ts+64-0
The dropzone now keeps the preview responsive while retries happen in the background.
Command: pnpm test src/features/uploads/image-upload.pipeline.spec.ts
The regression test now covers immediate preview rendering, worker completion, and recovery from a failed signed URL request on a large image upload.
The upload pipeline changes are ready for review. I attached the worker split, retry boundary, and regression test updates to the pull request.
Ready for review
+312-22- Compression moved to background worker
- Preview stays responsive during large uploads
- Signed URL retry boundary added
- Upload pipeline tests updated