Skip to content

refactor: use renderable guard for suffix - #337

Merged
yoyo837 merged 1 commit into
react-component:masterfrom
QDyanbing:refactor-renderable-guards
Sep 3, 2026
Merged

refactor: use renderable guard for suffix#337
yoyo837 merged 1 commit into
react-component:masterfrom
QDyanbing:refactor-renderable-guards

Conversation

@QDyanbing

@QDyanbing QDyanbing commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

说明

  • 使用 isReactRenderable 统一判断 suffix 是否需要渲染
  • 支持数字 0NaN 等有效 React 内容
  • 通过 Fragment 兼容当前 @rc-component/input@1.3.1 的 suffix 判断
  • @rc-component/util 的最低版本提升到首次提供该 helper 的 ^1.13.0

验证

  • npm run tsc
  • npm test -- --runInBand
  • git diff --check

关联 ant-design/ant-design#59193

Summary by CodeRabbit

  • 错误修复

    • 优化 Mentions 组件后缀内容的渲染判断,确保可渲染内容及清除功能按预期显示。
    • 改善后缀传递方式,提升复杂后缀内容的兼容性。
  • 依赖更新

    • 更新相关工具依赖版本,带来兼容性和稳定性改进。

@vercel

vercel Bot commented Sep 3, 2026

Copy link
Copy Markdown

@QDyanbing is attempting to deploy a commit to the afc163's projects Team on Vercel.

A member of the Team first needs to authorize it.

@coderabbitai

coderabbitai Bot commented Sep 3, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Team

Run ID: 9b3d8ddb-e00d-4272-ab17-2446ebd60bfa

📥 Commits

Reviewing files that changed from the base of the PR and between ac4e0ea and 24766b4.

📒 Files selected for processing (2)
  • package.json
  • src/Mentions.tsx

Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review.


Walkthrough

升级 @rc-component/util,并调整 Mentionssuffix 的可渲染性判断及传递方式。

Changes

Mentions 后缀渲染处理

Layer / File(s) Summary
后缀可渲染性处理
package.json, src/Mentions.tsx
升级 @rc-component/utilMentions 使用 isReactRenderable 判断 suffix,并将可渲染值包装为 Fragment 后传递给 BaseInput

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to 24766

Mentions suffix handling now consistently accepts React-renderable values such as 0 and NaN while preserving input compatibility through Fragment wrapping. The required utility dependency is updated accordingly, and no current merge-blocking risk remains.

Suggested reviewers: zombiej, afc163

Poem

小兔捧着后缀跑,
Fragment 轻轻把它抱。
util 版本向前跳,
BaseInput 收好新花帽。
清除按钮也报到。

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题“refactor: use renderable guard for suffix”准确概括了本次变更的主要内容,即使用 isReactRenderable 重构 suffix 的渲染判断。标题简洁、明确,并与代码变更和 PR 目标一致。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (1 skipped: 1 unsupported.)

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@codecov

codecov Bot commented Sep 3, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.36%. Comparing base (ac4e0ea) to head (24766b4).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #337   +/-   ##
=======================================
  Coverage   98.35%   98.36%           
=======================================
  Files           8        8           
  Lines         304      305    +1     
  Branches       82       83    +1     
=======================================
+ Hits          299      300    +1     
  Misses          5        5           

☔ View full report in Codecov by Harness.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@yoyo837 yoyo837 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Reviewed the renderability semantics, helper selection, dependency floor, existing feedback, and completed CI results. The implementation looks correct. The Vercel failure is limited to team deployment authorization and is not a code or build failure.

@yoyo837
yoyo837 merged commit 7b50687 into react-component:master Sep 3, 2026
11 of 12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants