-
-
Notifications
You must be signed in to change notification settings - Fork 325
chore: Use directory=native instead of folder #681
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Summary of ChangesHello @zombieJ, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request refines the file upload component's directory handling by introducing more granular control over how files are processed during directory uploads. It allows users to choose between filtering files based on accepted types or directly uploading all files within a selected directory, aligning with native browser behavior. This change also streamlines the API by deprecating a redundant prop and includes a minor bug fix for single file uploads. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Walkthrough将文件接收逻辑集中为私有 helper Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant AjaxUploader
participant Filter as filterFile
participant Traverser as traverseFileTree
Note over User,AjaxUploader: 文件/目录选择或粘贴事件触发
User->>AjaxUploader: 提交 FileList / DataTransfer
AjaxUploader->>Traverser: (若目录) 遍历目录结构以收集文件
Traverser-->>AjaxUploader: 返回文件列表
AjaxUploader->>Filter: 对每个文件调用 filterFile(file, isDataTransfer?)
alt filter 返回 true
Filter-->>AjaxUploader: 接受该文件
else filter 返回 false
Filter-->>AjaxUploader: 拒绝该文件
end
AjaxUploader->>User: 仅对被接受的文件触发上传(onStart/onChange)
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 分钟
Possibly related PRs
诗歌
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (3)
🧰 Additional context used🧠 Learnings (1)📚 Learning: 2025-04-09T06:22:00.335ZApplied to files:
🧬 Code graph analysis (3)src/AjaxUploader.tsx (2)
tests/uploader.spec.tsx (4)
src/interface.tsx (1)
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✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #681 +/- ##
==========================================
+ Coverage 89.03% 89.58% +0.55%
==========================================
Files 6 6
Lines 301 317 +16
Branches 80 90 +10
==========================================
+ Hits 268 284 +16
Misses 33 33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
This pull request refactors the directory upload functionality by replacing the deprecated folder prop with an enhanced directory prop, which now accepts a 'native' value to bypass file type filtering. This is a clean implementation that improves the component's flexibility. The changes also include corresponding updates to the interface and new tests to cover the added functionality. Additionally, the PR silently fixes a bug where file filtering was not applied correctly for non-directory uploads and another bug related to single file selection. My review includes a suggestion to improve the robustness of the new tests by using waitFor instead of setTimeout.
Summary by CodeRabbit
新功能
改进
测试