feat: add retryUpload method for upload - #723
Conversation
- Add retryUpload method to AjaxUploader - Add retryUpload method to Upload component - Add unit test for retryUpload - Update README docs Co-Authored-By: Claude <noreply@anthropic.com>
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
|
Someone is attempting to deploy a commit to the React Component Team on Vercel. A member of the Team first needs to authorize it. |
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Walkthrough新增 Changes文件重试上传
Estimated code review effort: 3 (Moderate) | ~20 minutes Sequence Diagram(s)sequenceDiagram
participant Test
participant Upload
participant AjaxUploader
participant processFile
participant post
Test->>Upload: 调用 retryUpload(file)
Upload->>AjaxUploader: 转发 retryUpload(file)
AjaxUploader->>processFile: 重新解析 originFile
processFile-->>AjaxUploader: 返回 fileInfo
AjaxUploader->>post: parsedFile 存在时提交 fileInfo
post-->>Test: 创建新的上传请求
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #723 +/- ##
==========================================
- Coverage 89.58% 89.55% -0.04%
==========================================
Files 6 6
Lines 317 335 +18
Branches 94 97 +3
==========================================
+ Hits 284 300 +16
- Misses 33 35 +2 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/AjaxUploader.tsx`:
- Around line 304-310: Update retryUpload to handle rejected promises from
processFile, reusing the existing upload flow’s preprocessing-error strategy and
adding an explicit catch to the promise chain. Return the resulting promise so
callers can observe or handle failures, while preserving the current parsedFile
check and post behavior.
In `@tests/uploader.spec.tsx`:
- Around line 260-271: 更新 tests/uploader.spec.tsx 中 retryUpload 的测试夹具,使 file 符合
RcFile 合约:使用带稳定 uid 的 File 夹具,并移除对 file 的 as any 绕过。保留 files.item
的必要模拟,同时在请求断言中验证重试请求收到该正确文件,确保 post 使用 origin.uid 作为正确索引。
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b182eb6a-62f6-4bce-869e-c0546118dfe8
📒 Files selected for processing (5)
README.mdREADME.zh-CN.mdsrc/AjaxUploader.tsxsrc/Upload.tsxtests/uploader.spec.tsx
9c1b932 to
9c18602
Compare
背景
新增
retryUpload方法,允许用户重试上传失败的文件。关联issue: ant-design/ant-design#27021
修改内容
AjaxUploader组件中添加retryUpload方法Upload组件中暴露retryUpload方法使用示例
测试覆盖
Summary by CodeRabbit
Summary by CodeRabbit
新功能
retryUpload方法,可在组件实例上触发重试。文档
retryUpload(file),并调整方法表格排版。测试
action/data异步抛错时不发起新增请求。