Skip to content

Conversation

WLyKan
Copy link
Contributor

@WLyKan WLyKan commented Sep 16, 2025

classNames 中的 root 的值应该是字符串,而不是对象

Summary by CodeRabbit

  • 文档
    • 更新 TooltipProps.overlayClassName 注释,将弃用示例由 classNames={{ root: {} }} 更正为 classNames={{ root: '' }},明确推荐写法并提升可读性。
    • 不影响运行时行为或类型签名,无需用户迁移或额外操作。

classNames 中的 root 的值应该是字符串,而不是对象
Copy link

vercel bot commented Sep 16, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
tooltip Error Error Sep 16, 2025 1:36am

Copy link

coderabbitai bot commented Sep 16, 2025

Walkthrough

仅在 src/Tooltip.tsx 中更新了 TooltipProps.overlayClassName 的 JSDoc 文档,调整弃用指引示例为使用字符串而非对象;无类型签名、运行时或控制流变更。

Changes

Cohort / File(s) Summary
文档注释更新
`src/Tooltip.tsx`
更新 JSDoc:将弃用指引示例由 `classNames={{ root: {} }}` 改为 `classNames={{ root: '' }}`;未改动类型、导出或运行时代码。

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Possibly related PRs

Suggested reviewers

  • afc163
  • zombieJ

Poem

我把注释轻轻梳,耳语穿过风与书。
root 不再抱空壳,化作字符串细如絮。
代码沉稳没一触,
只留小兔点点足,🥕
“文档已更,请过目。”

Pre-merge checks and finishing touches

❌ Failed checks (1 inconclusive)
Check name Status Explanation Resolution
Title Check ❓ Inconclusive 标题 "fix: typo" 过于模糊且缺乏上下文,无法清楚传达本次变更的主要内容。根据 PR 摘要,实际变更只是修正 TooltipProps.overlayClassName 的 JSDoc(说明 classNames.root 应为字符串而非对象),因此标题应更具体以便审阅者快速识别主要修改点。 建议将标题改为更具描述性的短句,例如 "docs: fix TooltipProps.overlayClassName JSDoc — classNames.root 应为字符串" 或 "fix(tooltip): correct classNames.root example in TooltipProps JSDoc",以便一目了然地反映这是文档注释的修正。
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Tip

👮 Agentic pre-merge checks are now available in preview!

Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.

  • Built-in checks – Quickly apply ready-made checks to enforce title conventions, require pull request descriptions that follow templates, validate linked issues for compliance, and more.
  • Custom agentic checks – Define your own rules using CodeRabbit’s advanced agentic capabilities to enforce organization-specific policies and workflows. For example, you can instruct CodeRabbit’s agent to verify that API documentation is updated whenever API schema files are modified in a PR. Note: Upto 5 custom checks are currently allowed during the preview period. Pricing for this feature will be announced in a few weeks.

Please see the documentation for more information.

Example:

reviews:
  pre_merge_checks:
    custom_checks:
      - name: "Undocumented Breaking Changes"
        mode: "warning"
        instructions: |
          Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).

Please share your feedback with us on this Discord post.


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

Summary of Changes

Hello @WLyKan, 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!

此拉取请求旨在纠正 Tooltip 组件中 overlayClassName 属性的 JSDoc 注释中的一个排版错误。它更新了 classNames 示例的 root 属性值,以正确反映其应为字符串而非对象,从而提高了文档的准确性。

Highlights

  • JSDoc 示例修正: 修正了 src/Tooltip.tsx 文件中 overlayClassName 属性的 JSDoc 注释,将 classNames={{ root: {} }} 的示例用法更新为 classNames={{ root: '' }},以明确 root 属性应为字符串类型。
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

这个 PR 修正了 TooltipProps 接口中 overlayClassName 属性 JSDoc 注释里的一个错误。旧的注释中,建议使用的 classNames={{ root: {} }} 示例是错误的,因为 root 属性应该是一个字符串。本次修改将其更正为 classNames={{ root: '' }},这与 TooltipClassNames 类型定义一致,能够为开发者提供正确的指引。这是一个很好的修正。

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

🧹 Nitpick comments (1)
src/Tooltip.tsx (1)

35-35: 示例更具可读性的小改动(可选)

当前示例使用空字符串,容易被理解为“占位而非实际 class”。建议在示例里给出非空占位值,提高可读性。

应用如下 diff:

-  /** @deprecated Please use `classNames={{ root: '' }}` */
+  /** @deprecated Please use `classNames={{ root: 'your-class' }}` */
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 3a902d4 and 937e5ec.

📒 Files selected for processing (1)
  • src/Tooltip.tsx (1 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: thinkasany
PR: react-component/tooltip#484
File: src/Popup.tsx:20-25
Timestamp: 2024-11-28T13:00:19.052Z
Learning: `overlayInnerClassName` 属性在 `Popup.tsx` 中是供内部使用的,已经通过 `classNames.inner` 在现有的测试用例中得到验证,无需单独添加测试。
📚 Learning: 2024-11-28T13:00:19.052Z
Learnt from: thinkasany
PR: react-component/tooltip#484
File: src/Popup.tsx:20-25
Timestamp: 2024-11-28T13:00:19.052Z
Learning: `overlayInnerClassName` 属性在 `Popup.tsx` 中是供内部使用的,已经通过 `classNames.inner` 在现有的测试用例中得到验证,无需单独添加测试。

Applied to files:

  • src/Tooltip.tsx
🔇 Additional comments (1)
src/Tooltip.tsx (1)

35-36: JSDoc 示例改为字符串 — 同意合并,需确认仓内示例已更新

与 TooltipClassNames.root 的 string 类型及 popupClassName={classNames(...)} 用法一致,变更可合并。已尝试全仓搜索旧写法,但 rg 未搜索任何文件,无法验证是否仍有示例使用对象写法。在合并前运行下列脚本以确认仓内是否仍有 classNames={{ root: {...} }} 或空对象示例:

#!/bin/bash
set -euo pipefail

# 1) 反模式:classNames={{ root: { ... } }}
rg -n --hidden --no-ignore -S -C2 'classNames\s*=\s*\{\s*root\s*:\s*\{' || true

# 2) 空对象示例:classNames={{ root: {} }}
rg -n --hidden --no-ignore -S -C2 'classNames\s*=\s*\{\s*root\s*:\s*\{\s*\}\s*\}' || true

# 3) 推荐字符串写法(单/双引号)
rg -n --hidden --no-ignore -S -C1 "classNames\\s*=\\s*\\{\\s*root\\s*:\\s*'[^']*'\\s*\\}" || true
rg -n --hidden --no-ignore -S -C1 'classNames\s*=\s*\{\s*root\s*:\s*"[^"]*"\s*\}' || true

# 若仍无输出,使用 --debug 排查原因
if ! rg --hidden --no-ignore -n 'classNames' >/dev/null 2>&1; then
  echo "rg 未搜索到任何文件;在本地运行 'rg --debug <pattern>' 排查原因。"
fi

Copy link

codecov bot commented Sep 16, 2025

Codecov Report

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

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #500   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files            3         3           
  Lines           33        33           
  Branches        12        12           
=========================================
  Hits            33        33           

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

@yoyo837 yoyo837 merged commit 6558417 into react-component:master Sep 16, 2025
8 of 9 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