Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kimteayon
Copy link
Collaborator

@kimteayon kimteayon commented Nov 28, 2025

中文版模板 / Chinese template

🤔 This is a ...

  • 🆕 New feature
  • 🐞 Bug fix
  • 📝 Site / documentation improvement
  • 📽️ Demo improvement
  • 💄 Component style improvement
  • 🤖 TypeScript definition improvement
  • 📦 Bundle size optimization
  • ⚡️ Performance optimization
  • ⭐️ Feature enhancement
  • 🌐 Internationalization
  • 🛠 Refactoring
  • 🎨 Code style optimization
  • ✅ Test Case
  • 🔀 Branch merge
  • ⏩ Workflow
  • ⌨️ Accessibility improvement
  • ❓ Other (about what?)

🔗 Related Issues

  • Describe the source of related requirements, such as links to relevant issue discussions.
  • For example: close #xxxx, fix #xxxx

💡 Background and Solution

  • The specific problem to be addressed.
  • List the final API implementation and usage if needed.
  • If there are UI/interaction changes, consider providing screenshots or GIFs.

📝 Change Log

Language Changelog
🇺🇸 English
🇨🇳 Chinese Attachments 修复未设置 maxCount 时上传按钮未显示的问题 ,以及修复 antdv6 的 props 升级 和 FileCard props 错误

Summary by CodeRabbit

发布说明

  • 重构
    • 精简并统一了文件列表中扩展/上传按钮的显示条件,简化渲染分支,提升可读性与可维护性。
  • 文档
    • 在附件组件文档中新增了 maxCount 属性说明,补充了最大可添加项的使用说明与示例。

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 28, 2025

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (2)
  • packages/x/components/sender/__tests__/__snapshots__/demo-extend.test.ts.snap is excluded by !**/*.snap
  • packages/x/components/sender/__tests__/__snapshots__/demo.test.ts.snap is excluded by !**/*.snap

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Note

Other AI code review bot(s) detected

CodeRabbit 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

Walkthrough

提取并统一附件列表中扩展名/上传按钮的显示条件;将进度组件的圆环样式属性从 trailColor 改为 railColor;移除文件卡图片预览的临时 preview 传递;更新中/英文文档,新增 maxCount 与调整 mask 描述。总体为局部渲染与文档调整。

Changes

Cohort / File(s) Change summary
附件列表组件变更
packages/x/components/attachments/FileList/index.tsx
提取本地常量 showExtension 封装扩展名/上传按钮显示条件,替换原有内联条件渲染为 showExtension ? ... : null,行为等价但分支更集中。
进度组件样式 prop 调整
packages/x/components/attachments/FileList/Progress.tsx
将传递给 Antd Progress 的轨道颜色属性由 trailColor 改为 railColor(内部 prop 名称调整,外部签名未变)。
文件卡渲染变更
packages/x/components/file-card/FileCard.tsx
移除为图片类型构建并传递的临时 preview 对象,删除对应的 preview prop 传递;其余渲染路径未改动。
文档 — 英文
packages/x/components/attachments/index.en-US.md, packages/x/components/file-card/index.en-US.md
在 Attachments 文档的 AttachmentsProps 中添加 maxCount 属性说明(类型 number);更新 FileCard 的 mask 描述,提示 mask 对图片预览无效并指向 imageProps
文档 — 中文
packages/x/components/attachments/index.zh-CN.md, packages/x/components/file-card/index.zh-CN.md
同步添加 maxCount 到附件组件 API 文档;扩展 mask 属性描述为“遮罩内容,图片预览此配置不生效,请参考 imageProps 属性”。

预计代码审查工作量

🎯 3 (中等) | ⏱️ ~20 分钟

  • 重点检查 showExtension 在边界条件下的逻辑(disabledmaxCount 未定义、maxCountitems.length 的相等/小于/大于情况,以及 0/1 边界)。
  • 验证 Progress 中 railColor 是否与样式系统、主题和之前 trailColor 的用途一致(视觉回归风险)。
  • 验证移除 preview 传递是否影响图片懒加载、占位或第三方 Image 组件行为。
  • 校对新增/修改文档描述与实际行为是否一致。

诗歌

🐰 我把条件藏进小常量,
按钮悄悄跳上了明朗台,
圆环换了新名字在转圈,
预览轻轻收起旧怀抱,
兔子祝贺:改动清新又不坏 ✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题清晰准确地总结了主要变更:修复 Attachments 组件的扩展按钮显示问题和 Ant Design v6 属性更新。

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 28, 2025

Preview is ready

@dosubot dosubot bot added the bug Something isn't working label Nov 28, 2025
@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kimteayon, 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 resolves a user interface issue within the attachments component, specifically ensuring that the upload button is consistently displayed when there is capacity for more file uploads, even if a maximum count for attachments hasn't been explicitly configured. This enhancement improves the usability of the file upload feature by making the upload option reliably available to users.

Highlights

  • Bug Fix: Addressed an issue in the attachments component where the upload button was not visible when the maxCount property was not explicitly defined, preventing users from adding more files.
  • Logic Refinement: Improved the conditional rendering logic for the upload button by introducing a showExtension variable, which now correctly evaluates whether the button should be displayed based on the disabled state and the maxCount limit.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a 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 correctly fixes a bug where the upload button was not displayed when maxCount was not set on attachments. The logic for showing the upload button has been extracted into a showExtension variable, which improves readability. I have one suggestion to further simplify the condition for this new variable, making the code even cleaner.

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 28, 2025

Deploying ant-design-x with  Cloudflare Pages  Cloudflare Pages

Latest commit: c6e2266
Status: ✅  Deploy successful!
Preview URL: https://f9e22172.ant-design-x.pages.dev
Branch Preview URL: https://fix-attachments.ant-design-x.pages.dev

View logs

Copy link
Contributor

@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: 0

🧹 Nitpick comments (1)
packages/x/components/attachments/FileList/index.tsx (1)

127-129: 建议简化条件逻辑。

条件中的 upload.maxCount && 检查是多余的。当 maxCount 未定义时,第一个条件已经处理;当 maxCount 为数字(包括 0)时,直接比较 maxCount > items.length 就能正确工作。

应用此差异来简化逻辑:

  const showExtension =
    !disabled &&
-   (typeof upload.maxCount === 'undefined' || (upload.maxCount && upload.maxCount > items.length));
+   (typeof upload.maxCount === 'undefined' || upload.maxCount > items.length);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9b946b1 and b069212.

📒 Files selected for processing (1)
  • packages/x/components/attachments/FileList/index.tsx (3 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: build preview
  • GitHub Check: size
  • GitHub Check: test
  • GitHub Check: Cloudflare Pages
🔇 Additional comments (1)
packages/x/components/attachments/FileList/index.tsx (1)

157-171: 代码逻辑正确!

条件渲染清晰地实现了 PR 目标:当未设置 maxCount 或当前上传数量未达到上限时显示上传按钮。这正确修复了上传按钮未显示的问题。

@github-actions
Copy link
Contributor

github-actions bot commented Nov 28, 2025

size-limit report 📦

Path Size
packages/x/dist/antdx.min.js 55.42 KB (-48 B 🔽)
packages/x-sdk/dist/x-sdk.min.js 7.29 KB
packages/x-markdown/dist/x-markdown.min.js 50.77 KB
packages/x-markdown/dist/plugins/code-high-light.min.js 317.77 KB
packages/x-markdown/dist/plugins/latex.min.js 61.95 KB
packages/x-markdown/dist/plugins/mermaid.min.js 885.67 KB

@codecov
Copy link

codecov bot commented Nov 28, 2025

Bundle Report

Bundle size has no change ✅

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Nov 30, 2025
@codecov
Copy link

codecov bot commented Nov 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.09%. Comparing base (3054510) to head (c6e2266).
⚠️ Report is 5 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1395      +/-   ##
==========================================
- Coverage   94.10%   94.09%   -0.01%     
==========================================
  Files         144      144              
  Lines        3712     3711       -1     
  Branches     1039     1038       -1     
==========================================
- Hits         3493     3492       -1     
  Misses        217      217              
  Partials        2        2              

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@kimteayon kimteayon merged commit 48d5344 into main Dec 1, 2025
14 checks passed
@kimteayon kimteayon deleted the fix_attachments branch December 1, 2025 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer

Projects

None yet

3 participants