Skip to content
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

feat(uploader): add onOverLimit props & fix incorrect updating files when type = multiple #2566

Open
wants to merge 4 commits into
base: next
Choose a base branch
from

Conversation

Alex-huxiyang
Copy link
Collaborator

@Alex-huxiyang Alex-huxiyang commented Sep 4, 2024

  • 新增onOverLimit回调

  • 修复多个文件上传的所选文件的错误

  • 新特性提交

  • 日常 bug 修复

  • 站点、文档改进

  • TypeScript 定义更新

Summary by CodeRabbit

  • 新功能

    • 为上传组件添加了 onOverLimit 回调函数,用于处理超过文件上传限制的情况,提供用户反馈。
    • 该功能在多个演示组件中实现,改善了用户体验。
  • 文档更新

    • 更新了相关文档,以反映 onOverLimit 的使用和功能说明。

Copy link

coderabbitai bot commented Sep 4, 2024

Walkthrough

此次更改引入了一个新的可选回调函数onOverLimit,用于处理文件上传数量超过指定限制的情况。该功能在多个文件中进行了实现,包括Uploader组件的不同示例和文档,旨在改善文件上传过程中的用户反馈和错误处理。

Changes

文件 更改摘要
src/packages/uploader/demos/h5/demo7.tsx
src/packages/uploader/demos/taro/demo8.tsx
添加了onOverLimit属性到Uploader组件,用于处理文件数量超限的情况,记录超出限制的文件。
src/packages/uploader/doc.en-US.md
src/packages/uploader/doc.md
src/packages/uploader/doc.taro.md
src/packages/uploader/doc.zh-TW.md
引入onOverLimit事件处理程序,提供用户反馈以处理文件数量超限的情况。
src/packages/uploader/uploader.taro.tsx
src/packages/uploader/uploader.tsx
UploaderProps接口中添加onOverLimit回调,更新InternalUploader组件以处理文件数量超限的逻辑。

Poem

🐰 在上传的路上跳跃,
新功能让我欢笑,
超过限制不再烦恼,
反馈及时心情好!
文件数量有了道,
小兔子乐陶陶! 🌟


Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 263d5f2 and 92634e8.

Files selected for processing (3)
  • src/packages/uploader/doc.en-US.md (1 hunks)
  • src/packages/uploader/doc.taro.md (1 hunks)
  • src/packages/uploader/uploader.taro.tsx (5 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/packages/uploader/doc.taro.md
  • src/packages/uploader/uploader.taro.tsx
Additional comments not posted (1)
src/packages/uploader/doc.en-US.md (1)

176-176: 确认 onOverLimit 的描述正确。

描述“当文件数量超过 maxCount 时触发”与 PR 目标和 AI 生成的摘要一致。此描述已正确更新,无需进一步修改。


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

‼️ IMPORTANT
Auto-reply has been disabled for this repository in the CodeRabbit settings. The CodeRabbit bot will not respond to your replies unless it is explicitly tagged.

  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Sep 4, 2024

Codecov Report

Attention: Patch coverage is 14.28571% with 6 lines in your changes missing coverage. Please review.

Project coverage is 83.19%. Comparing base (8eefca4) to head (92634e8).
Report is 14 commits behind head on next.

Files with missing lines Patch % Lines
src/packages/uploader/uploader.tsx 14.28% 6 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next    #2566      +/-   ##
==========================================
- Coverage   83.21%   83.19%   -0.02%     
==========================================
  Files         217      217              
  Lines       17804    17809       +5     
  Branches     2574     2574              
==========================================
+ Hits        14815    14816       +1     
- Misses       2984     2988       +4     
  Partials        5        5              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Outside diff range, codebase verification and nitpick comments (1)
src/packages/uploader/uploader.tsx (1)

Line range hint 290-317: 使用临时数组 _files 来累积文件项,提高了代码的清晰度。

这是一个很好的改进,确保了无论文件是否为图像,状态都能够一致地更新。

提醒:为未覆盖的代码行添加测试。

静态分析工具指出,此代码段中的一些新增行没有被测试覆盖:

  • 第290行
  • 第308-309行
  • 第313-314行

为了确保代码的可靠性,请为这些行添加测试。

如果需要帮助编写测试,请告诉我,我很乐意提供帮助。

Tools
GitHub Check: codecov/patch

[warning] 308-309: src/packages/uploader/uploader.tsx#L308-L309
Added lines #L308 - L309 were not covered by tests


[warning] 313-314: src/packages/uploader/uploader.tsx#L313-L314
Added lines #L313 - L314 were not covered by tests

src/packages/uploader/doc.en-US.md Outdated Show resolved Hide resolved
src/packages/uploader/uploader.tsx Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant