Skip to content

type: make title property optional in notification#56027

Merged
afc163 merged 5 commits intomasterfrom
fix/make-title-optional-in-notification-args
Dec 3, 2025
Merged

type: make title property optional in notification#56027
afc163 merged 5 commits intomasterfrom
fix/make-title-optional-in-notification-args

Conversation

@afc163
Copy link
Copy Markdown
Member

@afc163 afc163 commented Dec 2, 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

ref #55805 (comment)

close #38084

💡 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 Make notification title property optional.
🇨🇳 Chinese notification title 属性修改为可选。

@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 Dec 2, 2025

Preview is ready

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 2, 2025

👁 Visual Regression Report for PR #56027 Passed ✅

🎯 Target branch: master (bff2570)
📖 View Full Report ↗︎
📖 Alternative Report ↗︎

🎊 Congrats! No visual-regression diff found.

@afc163 afc163 changed the title fix: make title property optional in notification ArgsProps interface type: make title property optional in notification ArgsProps interface Dec 2, 2025
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @afc163, 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 type definition inconsistency in the Notification component by making its title property optional in the ArgsProps interface. This change ensures that the component's TypeScript definition accurately reflects its intended usage, where a title might not always be provided, and aligns the documentation accordingly.

Highlights

  • TypeScript Definition Update: The title property within the ArgsProps interface for the Notification component has been updated to be optional, resolving a previous oversight where it was marked as required.
  • Documentation Alignment: The English and Chinese documentation for the Notification component has been updated to reflect that the title property is no longer a required field.
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.

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

cloudflare-workers-and-pages Bot commented Dec 2, 2025

Deploying ant-design-next with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0a91156
Status: ✅  Deploy successful!
Preview URL: https://0ca7db08.ant-design-next.pages.dev
Branch Preview URL: https://fix-make-title-optional-in-n.ant-design-next.pages.dev

View logs

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 2, 2025

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

Summary by CodeRabbit

发布说明

  • 变更
    • Notification 组件的 title 属性现已调整为可选项
    • message 属性已弃用,建议使用 title 属性代替
    • 已更新中英文文档和相应的 API 说明

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

概览

此PR通过引入新的title属性来替换已弃用的message属性,重构了Notification组件的API。title属性现为可选。已在英文和中文文档及变更日志中相应更新。

变更

文件类别 / 文件 变更摘要
变更日志文件
CHANGELOG.en-US.md, CHANGELOG.zh-CN.md
新增通知条目,说明新的title属性替代message属性,并标记message为已弃用
组件文档
components/notification/index.en-US.md, components/notification/index.zh-CN.md
更新API表格:title从必选改为非必选;message标记为已弃用,建议使用title替代
接口定义
components/notification/interface.ts
ArgsProps接口中,将title属性从必选改为可选(title?: React.ReactNode

代码审查工作量评估

🎯 2 (简单) | ⏱️ ~10 分钟

  • 主要为文档和变更日志的一致性更新,跨多个语言版本的重复性修改
  • 核心代码变更仅涉及单个接口属性的可选性调整,改动范围局限且逻辑简洁

🐰 标题来敲门,消息该退休,
title 新朋友,可选又自由,
文档齐整理,API焕新颜,
认知无矛盾,和谐又优雅!✨

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Linked Issues check ⚠️ Warning PR变更使title属性可选,但关联Issue #38084的目标是添加title作为message的别名,两者目标不匹配。 title属性应作为message的别名而非替代品,允许同时使用两个属性。当前实现仅使title可选,未实现别名映射。
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed 标题清晰简洁地总结了主要变更:使notification的title属性变为可选。
Description check ✅ Passed 描述关联到相关问题并提供了变更日志,说明了修改内容与TypeScript定义改进相关。
Out of Scope Changes check ✅ Passed 所有变更(使title可选、更新文档和changelog)均在scope内,与PR目标一致。
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 fix/make-title-optional-in-notification-args

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between bff2570 and 0a91156.

📒 Files selected for processing (5)
  • CHANGELOG.en-US.md (1 hunks)
  • CHANGELOG.zh-CN.md (1 hunks)
  • components/notification/index.en-US.md (1 hunks)
  • components/notification/index.zh-CN.md (1 hunks)
  • components/notification/interface.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

**/*.{ts,tsx}: Always use TypeScript with strict type checking
Never use any type - define precise types instead
Use interfaces (not type aliases) for object structures
Export all public interface types
Prefer union types over enums, use as const for constants
Use early returns to improve readability
Support tree shaking
Follow import order: React → dependencies → antd components → custom components → types → styles
Prefer antd built-in components over external dependencies
Pass all ESLint and TypeScript checks
No console errors or warnings

**/*.{ts,tsx}: Use camelCase for property names
All components and functions must provide accurate type definitions
Avoid using any type, define types as precisely as possible
Use interface rather than type alias for defining object structures
All TypeScript should compile without errors or warnings
Use generics appropriately to enhance type flexibility
Use intersection types (&) to merge multiple types
Use literal union types to define limited option sets
Avoid using enum, prefer union types and as const
Rely on TypeScript's type inference as much as possible
Use type assertions (as) only when necessary
Complex data structures should be split into multiple interface definitions
Avoid outdated APIs and keep updated to new recommended usage

Files:

  • components/notification/interface.ts
components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Never hardcode colors, sizes, or spacing values

components/**/*.{ts,tsx}: Use TypeScript and React for component development
Use functional components and hooks, avoid class components
Use PascalCase for component names
Use complete names rather than abbreviations in component naming
Initialize properties should use default + PropName naming pattern
Panel opening should use open prop instead of visible
Event handlers should follow on + EventName naming pattern
Child component events should follow on + SubComponentName + EventName naming pattern
Components should provide a ref attribute with nativeElement and focus methods
Export all public interface types for user convenience
Component props should use interface definition named ComponentNameProps
Use CSS transitions for simple animations, rc-motion for complex animations
Respect user's prefers-reduced-motion setting for animations
Follow WCAG 2.1 AA level accessibility standards for styling
Achieve 100% test coverage
Use useLocale hook from components/locale/index.tsx to get localization configuration
Use React.memo, useMemo, and useCallback appropriately for performance optimization
Use React.ForwardRefRenderFunction for component ref types
Callback function types should have explicit parameter and return value definitions
Component state should have dedicated interfaces (e.g., ComponentNameState)
Components should display well on different screen sizes (responsive design)
Components should support right-to-left (RTL) reading direction
Support page zoom to 200% with normal layout
Avoid animations that cause flickering
Ensure code runs normally with no console errors
Avoid unnecessary re-renders
Support Tree Shaking for bundle optimization

Files:

  • components/notification/interface.ts
**/*.{ts,tsx,md}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Use 2-space indentation

Files:

  • components/notification/interface.ts
  • CHANGELOG.en-US.md
  • components/notification/index.en-US.md
  • CHANGELOG.zh-CN.md
  • components/notification/index.zh-CN.md
**/*.{ts,tsx,css}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Maintain cross-browser compatibility

Files:

  • components/notification/interface.ts
**/*.{ts,tsx,js}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js}: Use early returns to improve code readability
Pass all ESLint and TypeScript checks

Files:

  • components/notification/interface.ts
**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

**/*.md: Anchor IDs must match regex ^[a-zA-Z][\w-:\.]*$ and not exceed 32 characters (except for demo IDs containing -demo-)
FAQ section headings should have anchor IDs prefixed with faq-
Same topics in Chinese and English documentation should use identical anchor IDs
Provide both Chinese and English versions for documentation

Files:

  • CHANGELOG.en-US.md
  • components/notification/index.en-US.md
  • CHANGELOG.zh-CN.md
  • components/notification/index.zh-CN.md
CHANGELOG.{en-US,zh-CN}.md

📄 CodeRabbit inference engine (AGENTS.md)

CHANGELOG.{en-US,zh-CN}.md: Write CHANGELOG in both CHANGELOG.en-US.md and CHANGELOG.zh-CN.md
CHANGELOG should only mention changes with user-facing impact, omit internal changes
Write CHANGELOG from a developer perspective and describe the user's original problem
Include original PR links in CHANGELOG, with contributor links for community submissions

Files:

  • CHANGELOG.en-US.md
  • CHANGELOG.zh-CN.md
components/*/*.md

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

components/*/*.md: Provide both English and Chinese documentation
When documenting component APIs, use table structure with string defaults in backticks, boolean defaults as literal values, number defaults as literal values, no default value as -, descriptions starting with capital letter without ending period, properties sorted alphabetically

Files:

  • components/notification/index.en-US.md
  • components/notification/index.zh-CN.md
components/**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

components/**/*.md: Markdown documentation should have Chinese headings with manual English anchor IDs in format: ## 中文标题 {#english-anchor-id}
New properties should declare the version number they become available in documentation

Files:

  • components/notification/index.en-US.md
  • components/notification/index.zh-CN.md
🧠 Learnings (6)
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to CHANGELOG.{en-US,zh-CN}.md : CHANGELOG should only mention changes with user-facing impact, omit internal changes

Applied to files:

  • CHANGELOG.en-US.md
  • CHANGELOG.zh-CN.md
  • components/notification/index.zh-CN.md
📚 Learning: 2025-11-24T16:30:28.374Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: .github/copilot-instructions.md:0-0
Timestamp: 2025-11-24T16:30:28.374Z
Learning: Applies to components/*/*.md : When documenting component APIs, use table structure with string defaults in backticks, boolean defaults as literal values, number defaults as literal values, no default value as `-`, descriptions starting with capital letter without ending period, properties sorted alphabetically

Applied to files:

  • components/notification/index.en-US.md
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to CHANGELOG.{en-US,zh-CN}.md : Write CHANGELOG from a developer perspective and describe the user's original problem

Applied to files:

  • CHANGELOG.zh-CN.md
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to CHANGELOG.{en-US,zh-CN}.md : Include original PR links in CHANGELOG, with contributor links for community submissions

Applied to files:

  • CHANGELOG.zh-CN.md
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/*.md : Markdown documentation should have Chinese headings with manual English anchor IDs in format: ## 中文标题 {#english-anchor-id}

Applied to files:

  • components/notification/index.zh-CN.md
📚 Learning: 2025-11-24T16:31:15.831Z
Learnt from: CR
Repo: ant-design/ant-design PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-24T16:31:15.831Z
Learning: Applies to components/**/demo/*.md : Demo descriptions should be provided in both Chinese and English

Applied to files:

  • components/notification/index.zh-CN.md
⏰ 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). (1)
  • GitHub Check: Cloudflare Pages: ant-design-next
🔇 Additional comments (3)
components/notification/index.en-US.md (1)

66-67: 文档更新正确反映了接口变更。

移除 title 的必需标记并添加 message 的废弃说明是正确的,与 interface.ts 中将 title 改为可选属性的变更保持一致。先前的审查意见建议对废弃的 message 属性使用更清晰的措辞,您可以考虑采纳。

components/notification/index.zh-CN.md (1)

68-69: 文档更新正确反映了接口变更。

移除 title 的"必选"标记并添加 message 的废弃说明是正确的,与 interface.ts 中将 title 改为可选属性的变更保持一致。先前的审查意见建议在 message 描述中使用全角逗号,您可以考虑采纳以保持文档标点符号的一致性。

components/notification/interface.ts (1)

31-31: 正确实现了使 title 属性可选的核心变更。

title 从必需属性改为可选属性(添加 ? 标记)是正确的,符合 PR 目标。此变更保持了向后兼容性,因为已废弃的 message 属性仍然存在作为备选。TypeScript 语法正确,遵循了严格类型检查的编码规范。


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.

thinkasany
thinkasany previously approved these changes Dec 2, 2025
@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label Dec 2, 2025
@afc163 afc163 changed the title type: make title property optional in notification ArgsProps interface type: make title property optional in notification Dec 2, 2025
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 correctly makes the title property optional in the notification component's ArgsProps interface, addressing issue #38084. The change in interface.ts is accurate. I've provided a few suggestions to improve the changelogs and documentation for consistency and clarity. Specifically, the changelog entries appear to be for a different pull request and should be updated. There's also a minor punctuation correction for the Chinese documentation. Additionally, please note that the description property is marked as required in the documentation files, while it is optional in the TypeScript interface. This is an existing inconsistency that would be good to address in a future change.

Comment thread CHANGELOG.en-US.md
Comment thread CHANGELOG.zh-CN.md
Comment thread components/notification/index.en-US.md Outdated
Comment thread components/notification/index.zh-CN.md Outdated
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: afc163 <afc163@gmail.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Signed-off-by: afc163 <afc163@gmail.com>
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages Bot commented Dec 2, 2025

Deploying ant-design with  Cloudflare Pages  Cloudflare Pages

Latest commit: 0a91156
Status: ✅  Deploy successful!
Preview URL: https://b42e74c1.ant-design.pages.dev
Branch Preview URL: https://fix-make-title-optional-in-n.ant-design.pages.dev

View logs

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented Dec 2, 2025

size-limit report 📦

Path Size
dist/antd.min.js 527.43 KB
dist/antd-with-locales.min.js 620.53 KB

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Dec 2, 2025

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 2, 2025

Bundle Report

Changes will decrease total bundle size by 8.25MB (-67.96%) ⬇️. This is within the configured threshold ✅

Detailed changes
Bundle name Size Change
antd.min-array-push 3.89MB -8.25MB (-67.96%) ⬇️

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.min.js (New) 2.14MB 2.14MB 100.0% 🚀
antd.min.js (New) 1.75MB 1.75MB 100.0% 🚀
antd-with-locales.js (Deleted) -6.38MB 0 bytes -100.0% 🗑️
antd.js (Deleted) -5.76MB 0 bytes -100.0% 🗑️

@codecov
Copy link
Copy Markdown

codecov Bot commented Dec 2, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##            master    #56027   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files          803       803           
  Lines        14825     14825           
  Branches      3914      3914           
=========================================
  Hits         14825     14825           

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

@afc163
Copy link
Copy Markdown
Member Author

afc163 commented Dec 2, 2025

Wait for code review.

@thinkasany
Copy link
Copy Markdown
Member

Wait for code review.

是不是可以合并了,看起来没啥问题。

@afc163 afc163 merged commit b2f0595 into master Dec 3, 2025
45 checks passed
@afc163 afc163 deleted the fix/make-title-optional-in-notification-args branch December 3, 2025 08:01
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.

Notification 的标题属性 message 可否增加 title 别名

3 participants