Skip to content

fix: allow zero gap#55803

Merged
li-jia-nan merged 1 commit intomasterfrom
flex-isNonNullable-gap
Nov 22, 2025
Merged

fix: allow zero gap#55803
li-jia-nan merged 1 commit intomasterfrom
flex-isNonNullable-gap

Conversation

@li-jia-nan
Copy link
Copy Markdown
Member

中文版模板 / 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 允许 gap 赋值为0
🇨🇳 Chinese 允许 gap 赋值为0

@bolt-new-by-stackblitz
Copy link
Copy Markdown

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 21, 2025

Preview is ready

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Nov 21, 2025

Visual Regression Build for PR #55803 Failed ❌

Potential causes:

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @li-jia-nan, 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 addresses a bug in the Flex component that prevented the gap property from correctly applying a value of 0. By refining the conditional logic for gap application, the change ensures that developers can now explicitly define a zero gap, providing more precise control over element spacing within flex containers.

Highlights

  • Bug Fix: Zero Gap Value: Resolved an issue where the gap property in the Flex component could not be set to 0, preventing explicit zero spacing.
  • Improved Gap Handling Logic: The condition for applying the gap style was updated from if (gap) to if (isNonNullable(gap)) to correctly interpret 0 as a valid, non-null value.
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.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Nov 21, 2025

📝 Walkthrough

Summary by CodeRabbit

Bug Fixes

  • 改进了Flex组件中gap属性的处理逻辑,确保仅在gap值有效时应用对应样式,防止不必要的样式应用,提升了组件稳定性。

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

Walkthrough

在 Flex 组件中引入 isNonNullable 工具函数,将 gap 属性的条件判断从宽松的 truthy 检查改为显式的非空检查,确保仅在 gap 有实际值时才应用样式。

Changes

Cohort / File(s) 变更摘要
Flex 组件 gap 属性改进
components/flex/index.tsx
新增 isNonNullable 工具导入;将 gap 条件判断从 truthy 检查改为显式非空检查,防止在 gap 为 undefined 或 null 时设置样式

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

  • 单个文件的局部修改,逻辑变化直观
  • 新增工具函数的导入需验证其实现和兼容性
  • 建议确认现有预设尺寸行为是否保持不变

Poem

🐰 空值守卫筑高墙,
显式检查更坦荡,
gap 不再偷偷藏,
组件更清爽,
兔兔拍手赞一声!✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed 标题清晰准确地反映了主要变更内容——允许 gap 属性支持零值,这与代码摘要中引入空值检查以防止在 gap 为 undefined 或 null 时设置样式的改动相符。
Description check ✅ Passed PR 描述清楚地说明这是一个 bug fix,目的是允许 gap 赋值为 0,与代码变更内容相关且提供了清晰的背景信息。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch flex-isNonNullable-gap

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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.

Copy link
Copy Markdown
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 fixes an issue where a gap value of 0 was not being applied to the Flex component. The change correctly addresses this by using an isNonNullable check instead of a simple truthiness check on the gap prop. My review includes a suggestion to make the condition more robust by also checking for empty strings, which are not valid CSS gap values.

Comment thread components/flex/index.tsx
@github-actions
Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
dist/antd.min.js 530.89 KB (+3 B 🔺)
dist/antd-with-locales.min.js 622.4 KB (+1 B 🔺)

Copy link
Copy Markdown
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: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 1d168f8 and 0d428e7.

📒 Files selected for processing (1)
  • components/flex/index.tsx (2 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). (17)
  • GitHub Check: build preview
  • GitHub Check: test lib/es module (es, 2/2)
  • GitHub Check: test lib/es module (es, 1/2)
  • GitHub Check: test-react-latest (dom, 1/2)
  • GitHub Check: build
  • GitHub Check: test-react-legacy (18, 2/2)
  • GitHub Check: test-react-legacy (18, 1/2)
  • GitHub Check: test-react-latest (dom, 2/2)
  • GitHub Check: test-node
  • GitHub Check: lint
  • GitHub Check: visual-diff snapshot (2/2)
  • GitHub Check: visual-diff snapshot (1/2)
  • GitHub Check: size
  • GitHub Check: build
  • GitHub Check: Analyze (javascript)
  • GitHub Check: build
  • GitHub Check: Cloudflare Pages: ant-design-next
🔇 Additional comments (1)
components/flex/index.tsx (1)

7-7: 导入语句正确!

引入 isNonNullable 工具函数是修复 gap=0 问题的关键,允许显式检查非空值而不是依赖 truthy 判断。

Comment thread components/flex/index.tsx
@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Nov 21, 2025

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying ant-design-next with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0d428e7
Status: ✅  Deploy successful!
Preview URL: https://bb513d3f.ant-design-next.pages.dev
Branch Preview URL: https://flex-isnonnullable-gap.ant-design-next.pages.dev

View logs

@cloudflare-workers-and-pages
Copy link
Copy Markdown

Deploying ant-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0d428e7
Status: ✅  Deploy successful!
Preview URL: https://990ab055.ant-design.pages.dev
Branch Preview URL: https://flex-isnonnullable-gap.ant-design.pages.dev

View logs

@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 21, 2025

Bundle Report

Changes will increase total bundle size by 8.33MB (212.94%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
antd.min-array-push 12.24MB 8.33MB (212.94%) ⬆️⚠️

Affected Assets, Files, and Routes:

view changes for bundle: antd.min-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
antd-with-locales.js (New) 6.43MB 6.43MB 100.0% 🚀
antd.js (New) 5.81MB 5.81MB 100.0% 🚀
antd-with-locales.min.js (Deleted) -2.15MB 0 bytes -100.0% 🗑️
antd.min.js (Deleted) -1.76MB 0 bytes -100.0% 🗑️

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

codecov Bot commented Nov 21, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 100.00%. Comparing base (1d168f8) to head (0d428e7).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #55803   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          803       803           
  Lines        14804     14804           
  Branches      3913      3913           
=========================================
  Hits         14804     14804           

☔ 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.

@li-jia-nan li-jia-nan merged commit a83362a into master Nov 22, 2025
49 of 50 checks passed
@li-jia-nan li-jia-nan deleted the flex-isNonNullable-gap branch November 22, 2025 02:35
coding-ice pushed a commit to coding-ice/ant-design that referenced this pull request Nov 22, 2025
@coderabbitai coderabbitai Bot mentioned this pull request Nov 23, 2025
17 tasks
@PeachScript PeachScript mentioned this pull request Dec 2, 2025
17 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants