feat(upload): add progress indicator and disable send during upload#1705
feat(upload): add progress indicator and disable send during upload#1705kaizhou-lab merged 5 commits intoiOfficeAI:mainfrom
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
376a2a7 to
6eebf5a
Compare
|
Hey @JerryLiu369 👋 整体方案很不错! 1. XHR 缺少
|
…pload Replace fetch() with XMLHttpRequest in uploadFileViaHttp to support upload progress events. Add a module-level upload state store (useUploadState) and wire all 4 upload entry points (sendbox drag, sendbox attach, workspace drag, workspace paste) to report progress. Show a thin progress bar in both sendbox and workspace toolbar, and disable the send button while uploads are in flight. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Each upload is now tagged with a source ('sendbox' | 'workspace') so
progress bars only show in the area where the upload originated, and
the send button is only disabled during sendbox uploads.
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Co-Authored-By: Claude Opus 4.6 <[email protected]>
6eebf5a to
8b7bada
Compare
- Add XHR abort event handler to prevent Promise leaks on cancelled uploads
- Move useSyncExternalStore snapshot getters to module level for stability
- Replace inline styles with UnoCSS utility classes in UploadProgressBar
- Fix i18next defaultValue syntax to use interpolation ({{count}})
- Use @Renderer alias for test import path
Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
|
Thanks for the thorough review, @kaizhou-lab! All 5 points have been addressed:
|
Summary
fetch()withXMLHttpRequestinuploadFileViaHttpto support upload progress eventsuseUploadStateviauseSyncExternalStore) — no Context Provider neededtrackUpload()Changes
src/renderer/hooks/file/useUploadState.tstrackUpload()anduseUploadState()hooksrc/renderer/components/media/UploadProgressBar.tsxsrc/renderer/services/FileService.tsfetchwith XHR for progress; addonProgressparam; integratetrackUploadinprocessDroppedFilessrc/renderer/components/chat/sendbox.tsxuseUploadState, disable send button during upload, renderUploadProgressBarsrc/renderer/pages/conversation/Workspace/hooks/useWorkspacePaste.tstrackUploadinto workspace paste upload loopsrc/renderer/pages/conversation/Workspace/components/WorkspaceToolbar.tsxUploadProgressBarin toolbarTest plan
npm run buildandelectron-vite buildpass cleanly🤖 Generated with Claude Code