-
-
Notifications
You must be signed in to change notification settings - Fork 198
chore: Update passing api #501
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Note Other AI code review bot(s) detectedCodeRabbit 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新增两个文档/示例展示双按钮提示;在 TooltipProps 中新增可选 Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as 用户
participant D as TwoButtonsDemo
participant Tr as UniqueProvider (Trigger)
participant T1 as Tooltip(Button 1)
participant T2 as Tooltip(Button 2)
participant O as Overlay
U->>D: 访问页面
D->>Tr: 初始化 UniqueProvider
D->>T1: 渲染 Tooltip1
D->>T2: 渲染 Tooltip2
rect rgb(235,245,255)
note right of U: 悬停 Button 1
U-->>T1: mouseenter
T1->>Tr: 显示请求(可能携带 unique)
Tr->>O: 渲染或复用背景(实验性 unique)
O-->>U: 显示提示 1
end
rect rgb(245,235,255)
note right of U: 悬停 Button 2
U-->>T2: mouseenter
T2->>Tr: 显示请求(可能携带 unique)
Tr->>O: 渲染或复用背景(实验性 unique)
O-->>U: 显示提示 2
end
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 分钟 Possibly related PRs
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 inconclusive)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
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.
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. Comment |
There was a problem hiding this 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 @zombieJ, 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
组件的一个实验性 unique
属性,旨在支持在过渡效果中重用背景,这得益于 @rc-component/trigger
的相关功能。同时,它更新了核心依赖库的版本,并提供了一个新的示例来具体演示这一新特性和 UniqueProvider
的使用方式。
Highlights
- API 更新: 为
TooltipProps
接口添加了一个实验性的unique
属性,用于配置Tooltip
在过渡期间重用背景的能力。 - 依赖更新: 将
@rc-component/trigger
和@rc-component/util
依赖更新到了最新版本,以确保兼容性和利用新功能。 - 新增示例: 引入了一个名为“两个按钮”的新演示,展示了如何结合使用
UniqueProvider
和多个Tooltip
组件。
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
-
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. ↩
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #501 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 3 3
Lines 33 33
Branches 12 12
=========================================
Hits 33 33 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code Review
本次 PR 更新了 @rc-component/trigger
和 @rc-component/util
的依赖版本,并在 Tooltip
组件中透传了 unique
属性。这个属性是一个实验性 API,用于优化过渡效果。同时,PR 添加了一个新的示例 twoButtons
来演示 UniqueProvider
的用法。整体来看,变更清晰明了。我只在 src/Tooltip.tsx
中对新属性的 JSDoc 注释提出了一些小的修改建议,以提高其可读性和准确性。
There was a problem hiding this 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 (3)
docs/demo/twoButtons.md (1)
1-12
: 补充实验性说明与版本要求,增强示例上下文建议在示例文案中点明该能力依赖
UniqueProvider
(实验性)以及最低版本(@rc-component/trigger >= 3.6.0
),便于用户避坑。可按下列方式微调文案:
-演示两个按钮的悬浮提示。 +演示在 UniqueProvider 下两个按钮的提示过渡背景复用(实验性)。 +依赖:@rc-component/trigger >= 3.6.0。src/Tooltip.tsx (1)
48-52
: 润色 JSDoc(语法与可读性)并标注实验性标签当前注释英文略别扭,且建议使用 TSDoc 实践标记实验性。
/** - * Config Tooltip can reuse of the bg for transition usage. - * This is a experimental API, may be not stable. + * Enable Tooltip to reuse the backdrop during transitions. + * @alpha Experimental: API surface may change. */ unique?: TriggerProps['unique'];docs/examples/twoButtons.tsx (1)
6-27
: 示例清晰可跑,但可去除冗余属性并稍作排版
trigger={['hover']}
已为默认值,可省略;按钮之间可加少量间距,阅读体验更好。<UniqueProvider> - <div style={{ margin: 100 }}> + <div style={{ margin: 100, display: 'flex', gap: 12 }}> <Tooltip placement="top" - trigger={['hover']} overlay="This is the first tooltip" motion={{ motionName: 'rc-tooltip-zoom' }} > <button type="button">Button 1</button> </Tooltip> <Tooltip placement="top" - trigger={['hover']} overlay="This is the second tooltip" motion={{ motionName: 'rc-tooltip-zoom' }} > <button type="button">Button 2</button> </Tooltip> </div> </UniqueProvider>
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
docs/demo/twoButtons.md
(1 hunks)docs/examples/twoButtons.tsx
(1 hunks)package.json
(1 hunks)src/Tooltip.tsx
(1 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). (1)
- GitHub Check: Socket Security: Pull Request Alerts
🔇 Additional comments (2)
src/Tooltip.tsx (1)
48-52
: 公开unique
类型定义以透传给 Trigger:方向正确类型关联
TriggerProps['unique']
并通过...restProps
透传,能保持与底层触发器同步,无需改动运行逻辑。赞同此做法。package.json (1)
44-45
: 结论:@rc-component/trigger@^3.6.0 不包含 UniqueProvider 或 TriggerProps.unique"@rc-component/trigger": "^3.6.0", "@rc-component/util": "^1.3.0",
经核查官方 README 与包页(v3.x / 3.6.0 的公开文档与类型声明),未见 UniqueProvider 或 TriggerProps.unique;原评论关于该版本包含该 API 的假设不成立。
Likely an incorrect or invalid review comment.
Warning Review the following alerts detected in dependencies. According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.
|
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
There was a problem hiding this 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
🧹 Nitpick comments (2)
.dumirc.ts (2)
4-6
: 恢复 isProdSite,避免生产环境文档站点资源路径错误注释掉 isProdSite 后,下方 base/publicPath 的条件切换也被移除;若部署到 GitHub Pages 子路径(/tooltip/),静态资源可能 404。建议恢复变量以保持与现有发布流程一致。
建议补丁:
-// const isProdSite = -// -// // 不是预览模式 同时是生产环境 -// -// process.env.PREVIEW !== 'true' && process.env.NODE_ENV === 'production'; +const isProdSite = + // 不是预览模式 同时是生产环境 + process.env.PREVIEW !== 'true' && process.env.NODE_ENV === 'production';
8-8
: 保留 name 常量,减少硬编码风险后续若恢复 base/publicPath,需要该常量;建议直接启用或从 package.json 派生,避免重复维护。
-// const name = 'tooltip'; +const name = 'tooltip';
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
.dumirc.ts
(2 hunks)src/Tooltip.tsx
(1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
- src/Tooltip.tsx
// base: isProdSite ? `/${name}/` : '/', | ||
// publicPath: isProdSite ? `/${name}/` : '/', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
base/publicPath 被注释可能导致 gh-pages 子路径部署 404
如果文档站点仍通过 gh-pages 挂载在 /tooltip/,当前配置会以根路径输出,生产访问将异常。建议按环境恢复条件配置。
- // base: isProdSite ? `/${name}/` : '/',
- // publicPath: isProdSite ? `/${name}/` : '/',
+ base: isProdSite ? `/${name}/` : '/',
+ publicPath: isProdSite ? `/${name}/` : '/',
请确认当前文档发布目标(例如 Vercel/Netlify 根域名 vs GitHub Pages 子路径)。若已迁移到根域名,可在 PR 描述注明,以免后续误回滚。
🏁 Script executed:
#!/bin/bash
set -euo pipefail
printf "Searching for dumi/umi config files (.dumirc.ts, dumirc.ts, .umirc.ts, umirc.ts)...\n\n"
files=()
while IFS= read -r -d '' f; do files+=("$f"); done < <(find . -type f \( -name ".dumirc.ts" -o -name "dumirc.ts" -o -name ".umirc.ts" -o -name "umirc.ts" \) -print0)
if [ ${#files[@]} -eq 0 ]; then
printf "No dumi/umi config file found\n\n"
else
for f in "${files[@]}"; do
printf "== FILE: %s ==\n" "$f"
nl -ba -w3 -s': ' "$f" | sed -n '1,200p'
printf "\n-- Matches for base/publicPath/isProdSite/name in this file --\n"
rg -n --hidden --no-ignore -S '\b(base|publicPath|isProdSite|name)\b' "$f" || true
printf "\n\n"
done
fi
printf "Searching for package.json files and printing key fields (homepage / scripts)...\n\n"
while IFS= read -r -d '' pj; do
printf "== %s ==\n" "$pj"
rg -n --hidden --no-ignore -n '"homepage"\s*:' "$pj" || true
rg -n --hidden --no-ignore -n '"scripts"\s*:' "$pj" || true
sed -n '1,200p' "$pj"
printf "\n"
done < <(find . -type f -name package.json -print0)
printf "Searching repo for gh-pages / github.io / vercel / netlify / CNAME references...\n\n"
rg -n --hidden --no-ignore -S 'gh-pages|github\.io|vercel|netlify|CNAME' || true
printf "\nSearching .github/workflows for pages/deploy steps...\n\n"
if [ -d .github/workflows ]; then
rg -n --hidden --no-ignore -S 'pages|gh-pages|deploy|vercel|netlify|publish' .github/workflows || true
else
printf "No .github/workflows directory\n"
fi
printf "\nDONE\n"
Length of output: 141
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
# 重试:运行下列脚本以查找相关配置文件并验证 base/publicPath 配置。
echo "1) 查找 dumi/umi 配置文件 (.dumirc.ts, dumirc.ts, .umirc.ts, umirc.ts)..."
if find . -type f \( -name ".dumirc.ts" -o -name "dumirc.ts" -o -name ".umirc.ts" -o -name "umirc.ts" \) -print -quit | grep -q .; then
find . -type f \( -name ".dumirc.ts" -o -name "dumirc.ts" -o -name ".umirc.ts" -o -name "umirc.ts" \) -print0 | \
while IFS= read -r -d '' f; do
echo "== FILE: $f =="
nl -ba -w3 -s': ' "$f" | sed -n '1,200p'
echo "-- 匹配 base/publicPath/isProdSite/name --"
if command -v rg >/dev/null 2>&1; then
rg -n --hidden --no-ignore -S '\b(base|publicPath|isProdSite|name)\b' "$f" || true
else
grep -nE '\b(base|publicPath|isProdSite|name)\b' "$f" || true
fi
echo
done
else
echo "未找到 dumi/umi 配置文件(.dumirc.ts/dumirc.ts/.umirc.ts/umirc.ts)"
fi
echo
echo "2) 查找 package.json 并显示 homepage / scripts 字段(若存在)..."
if find . -type f -name package.json -print -quit | grep -q .; then
find . -type f -name package.json -print0 | \
while IFS= read -r -d '' pj; do
echo "== $pj =="
if command -v rg >/dev/null 2>&1; then
rg -n '"homepage"\s*:' "$pj" || true
rg -n '"scripts"\s*:' "$pj" || true
else
grep -nE '"homepage"\s*:' "$pj" || true
grep -nE '"scripts"\s*:' "$pj" || true
fi
sed -n '1,200p' "$pj" || true
echo
done
else
echo "未找到 package.json 文件"
fi
echo
echo "3) 全仓库关键词搜索:gh-pages / github.io / vercel / netlify / CNAME ..."
if command -v rg >/dev/null 2>&1; then
rg -n --hidden --no-ignore -S 'gh-pages|github\.io|vercel|netlify|CNAME' || true
else
grep -RIn --binary-files=without-match -E 'gh-pages|github\.io|vercel|netlify|CNAME' . || true
fi
echo
echo "4) 检查 .github/workflows 中是否有 pages/gh-pages/部署步骤..."
if [ -d .github/workflows ]; then
if command -v rg >/dev/null 2>&1; then
rg -n --hidden --no-ignore -S 'pages|gh-pages|deploy|vercel|netlify|publish' .github/workflows || true
else
grep -RIn --binary-files=without-match -E 'pages|gh-pages|deploy|vercel|netlify|publish' .github/workflows || true
fi
else
echo "未找到 .github/workflows 目录"
fi
echo
echo "完成"
Length of output: 134
🏁 Script executed:
#!/usr/bin/env bash
set -euo pipefail
f="./.dumirc.ts"
if [ -f "$f" ]; then
echo "找到文件:$f,显示前 200 行并带行号:"
awk 'NR>=1 && NR<=200 {printf("%4d: %s\n", NR,$0)}' "$f" || true
echo
echo "-- 匹配(注释的 base/publicPath & 任何 base/publicPath/isProdSite/name 出现) --"
grep -nE '^\s*//\s*(base|publicPath)' "$f" || true
grep -nE '\b(base|publicPath|isProdSite|name)\b' "$f" || true
else
echo "未找到文件:$f"
fi
Length of output: 1159
修复 .dumirc.ts 的 base/publicPath 环境配置(避免 gh-pages 子路径 404)
验证:./.dumirc.ts 中 isProdSite/name(第 4–9 行)与 base/publicPath(第 21–22 行)均被注释,当前构建会以根路径输出;若站点通过 GitHub Pages 子路径(例如 /tooltip/)发布,将导致 404。
操作建议:
- 在 ./ .dumirc.ts 恢复环境判断与名称定义并恢复 base/publicPath(第 4–9、21–22 行)。示例:base: isProdSite ?
/${name}/
: '/', publicPath: isProdSite ?/${name}/
: '/'。 - 若已迁移到根域名(Vercel/Netlify),在 PR 描述中声明迁移并改为固定根路径或保留注释以避免误回滚。
🤖 Prompt for AI Agents
.dumirc.ts around lines 4–9 and 21–22: currently isProdSite/name and
base/publicPath lines are commented out causing builds to output to root and
breaking gh-pages subpath routing; restore the environment check and name
definition and re-enable base/publicPath with the conditional values (e.g. base:
isProdSite ? `/${name}/` : '/', publicPath: isProdSite ? `/${name}/` : '/'),
ensure the name variable is defined consistently with isProdSite usage, and if
the site has intentionally migrated to a root domain (Vercel/Netlify) note that
migration in the PR description instead of un-commenting to avoid accidental
rollbacks.
添加一个定义说明,本身不做代码变更。用例在 rc-trigger 中已实现。
Summary by CodeRabbit