Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@kimteayon
Copy link
Collaborator

@kimteayon kimteayon commented Nov 30, 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

💡 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
🇨🇳 Chinese 修复自定义语音识别 disable 逻辑错误问题

Summary by CodeRabbit

发布说明

  • Bug Fixes
    • 优化语音权限处理:在受控模式下跳过不必要的权限查询,并调整权限合并逻辑以在受控场景下正确授予语音能力,减少误阻塞并提升响应体验。
  • Style / UI
    • 改进加载态视觉:加载按钮的旋转指示器颜色调整为白色以提升在深色按钮上的可见性;加载期间按钮仍保持禁用状态。

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

@github-actions
Copy link
Contributor

github-actions bot commented Nov 30, 2025

Preview is ready

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @kimteayon, 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 resolves a bug related to the custom speech recognition disable logic within the useSpeech hook. The changes refine how speech recognition permissions are evaluated and how the overall allowSpeech status is determined, ensuring that explicit configurations via the allowSpeech prop are respected and can override default browser permission checks. This provides more robust and predictable control over speech input functionality.

Highlights

  • Bug Fix: Speech Recognition Disable Logic: Addressed a bug where the custom speech recognition disable logic was not working correctly, preventing proper control over speech input.
  • Conditional Permission Checks: Modified the useEffect hook that checks for speech recognition permissions to only run if the allowSpeech prop is not an object, allowing for more flexible control when allowSpeech is explicitly configured.
  • Refined mergedAllowSpeech Calculation: Updated the calculation of mergedAllowSpeech to prioritize explicit allowSpeech object configurations, ensuring that custom settings can override default browser permission states.
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.

@dosubot dosubot bot added the bug Something isn't working label Nov 30, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 30, 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

Walkthrough

修改了语音权限查询与合并允许逻辑:当 allowSpeech 以配置对象提供时跳过权限查询并使合并后的允许始终为允许;另外在 demo 的后缀渲染中调整了 LoadingButton 的 Spin 指示器颜色与若干格式化改动。

Changes

Cohort / File(s) Change summary
权限查询与合并逻辑
packages/x/components/sender/useSpeech.ts
仅在非受控模式下进行权限查询(依赖数组由 [] 改为 [speechInControlled]);当 allowSpeech 为配置对象时跳过权限查询并将 mergedAllowSpeech 设为允许;删除一处无行为影响的空行。
演示组件后缀渲染
packages/x/components/sender/demo/suffix.tsx
loading 分支中使用带自定义白色指示器样式的 Spin 作为 LoadingButtonindicator(通过 styles 设置颜色);移除一处无操作空行;其余 JSX 行为保持不变。

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 分钟

  • 重点复核 useSpeech.ts 中对对象型 allowSpeech 的检测条件与分支覆盖(确保不会误判布尔或未传值情况)
  • 验证 mergedAllowSpeech 在受控/非受控两种模式下的行为是否符合预期
  • 检查 demo 中传入 Spin 的样式属性与现有样式系统及按钮禁用状态的兼容性

Poem

兔子轻啄小代码,
权限分路不再愁,
指示灯白闪心安,
空行去处也优雅,
语音起航去远游 🐰🎧

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题与主要变更相关。PR修复了语音识别的disable逻辑问题,标题准确反映了这一核心变更。
✨ 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 fixsender

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.

Code Review

This pull request aims to fix a bug related to disabling custom speech recognition. The changes correctly prevent browser permission checks and adjust the speech availability logic when a custom speech configuration is provided. My review includes two main points: a high-severity issue with a missing dependency in a useEffect hook that could lead to bugs, and a suggestion to simplify a conditional expression for better readability. Overall, the core logic of the fix is sound, but the implementation detail in the useEffect needs to be addressed.

@codecov
Copy link

codecov bot commented Nov 30, 2025

Bundle Report

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

Detailed changes
Bundle name Size Change
x-markdown-array-push 1.61MB -1.18MB (-42.18%) ⬇️

Affected Assets, Files, and Routes:

view changes for bundle: x-markdown-array-push

Assets Changed:

Asset Name Size Change Total Size Change (%)
latex.js (New) 512.93kB 512.93kB 100.0% 🚀
static/KaTeX_AMS-Regular.*.ttf (New) 63.63kB 63.63kB 100.0% 🚀
static/KaTeX_Main-Regular.*.ttf (New) 53.58kB 53.58kB 100.0% 🚀
static/KaTeX_Main-Bold.*.ttf (New) 51.34kB 51.34kB 100.0% 🚀
static/KaTeX_Main-Italic.*.ttf (New) 33.58kB 33.58kB 100.0% 🚀
static/KaTeX_AMS-Regular.*.woff (New) 33.52kB 33.52kB 100.0% 🚀
static/KaTeX_Main-BoldItalic.*.ttf (New) 32.97kB 32.97kB 100.0% 🚀
static/KaTeX_Math-Italic.*.ttf (New) 31.31kB 31.31kB 100.0% 🚀
static/KaTeX_Math-BoldItalic.*.ttf (New) 31.2kB 31.2kB 100.0% 🚀
static/KaTeX_Main-Regular.*.woff (New) 30.77kB 30.77kB 100.0% 🚀
static/KaTeX_Main-Bold.*.woff (New) 29.91kB 29.91kB 100.0% 🚀
static/KaTeX_AMS-Regular.*.woff2 (New) 28.08kB 28.08kB 100.0% 🚀
static/KaTeX_Typewriter-Regular.*.ttf (New) 27.56kB 27.56kB 100.0% 🚀
static/KaTeX_Main-Regular.*.woff2 (New) 26.27kB 26.27kB 100.0% 🚀
static/KaTeX_Main-Bold.*.woff2 (New) 25.32kB 25.32kB 100.0% 🚀
static/KaTeX_SansSerif-Bold.*.ttf (New) 24.5kB 24.5kB 100.0% 🚀
latex.css (New) 24.32kB 24.32kB 100.0% 🚀
static/KaTeX_SansSerif-Italic.*.ttf (New) 22.36kB 22.36kB 100.0% 🚀
static/KaTeX_Main-Italic.*.woff (New) 19.68kB 19.68kB 100.0% 🚀
static/KaTeX_Fraktur-Bold.*.ttf (New) 19.58kB 19.58kB 100.0% 🚀
static/KaTeX_Fraktur-Regular.*.ttf (New) 19.57kB 19.57kB 100.0% 🚀
static/KaTeX_SansSerif-Regular.*.ttf (New) 19.44kB 19.44kB 100.0% 🚀
static/KaTeX_Main-BoldItalic.*.woff (New) 19.41kB 19.41kB 100.0% 🚀
static/KaTeX_Math-Italic.*.woff (New) 18.75kB 18.75kB 100.0% 🚀
static/KaTeX_Math-BoldItalic.*.woff (New) 18.67kB 18.67kB 100.0% 🚀
static/KaTeX_Main-Italic.*.woff2 (New) 16.99kB 16.99kB 100.0% 🚀
static/KaTeX_Main-BoldItalic.*.woff2 (New) 16.78kB 16.78kB 100.0% 🚀
static/KaTeX_Script-Regular.*.ttf (New) 16.65kB 16.65kB 100.0% 🚀
static/KaTeX_Math-Italic.*.woff2 (New) 16.44kB 16.44kB 100.0% 🚀
static/KaTeX_Math-BoldItalic.*.woff2 (New) 16.4kB 16.4kB 100.0% 🚀
static/KaTeX_Typewriter-Regular.*.woff (New) 16.03kB 16.03kB 100.0% 🚀
static/KaTeX_SansSerif-Bold.*.woff (New) 14.41kB 14.41kB 100.0% 🚀
static/KaTeX_SansSerif-Italic.*.woff (New) 14.11kB 14.11kB 100.0% 🚀
static/KaTeX_Typewriter-Regular.*.woff2 (New) 13.57kB 13.57kB 100.0% 🚀
static/KaTeX_Fraktur-Bold.*.woff (New) 13.3kB 13.3kB 100.0% 🚀
static/KaTeX_Fraktur-Regular.*.woff (New) 13.21kB 13.21kB 100.0% 🚀
static/KaTeX_Caligraphic-Bold.*.ttf (New) 12.37kB 12.37kB 100.0% 🚀
static/KaTeX_Caligraphic-Regular.*.ttf (New) 12.34kB 12.34kB 100.0% 🚀
static/KaTeX_SansSerif-Regular.*.woff (New) 12.32kB 12.32kB 100.0% 🚀
static/KaTeX_Size1-Regular.*.ttf (New) 12.23kB 12.23kB 100.0% 🚀
static/KaTeX_SansSerif-Bold.*.woff2 (New) 12.22kB 12.22kB 100.0% 🚀
static/KaTeX_SansSerif-Italic.*.woff2 (New) 12.03kB 12.03kB 100.0% 🚀
static/KaTeX_Size2-Regular.*.ttf (New) 11.51kB 11.51kB 100.0% 🚀
static/KaTeX_Fraktur-Bold.*.woff2 (New) 11.35kB 11.35kB 100.0% 🚀
static/KaTeX_Fraktur-Regular.*.woff2 (New) 11.32kB 11.32kB 100.0% 🚀
static/KaTeX_Script-Regular.*.woff (New) 10.59kB 10.59kB 100.0% 🚀
static/KaTeX_Size4-Regular.*.ttf (New) 10.36kB 10.36kB 100.0% 🚀
static/KaTeX_SansSerif-Regular.*.woff2 (New) 10.34kB 10.34kB 100.0% 🚀
static/KaTeX_Script-Regular.*.woff2 (New) 9.64kB 9.64kB 100.0% 🚀
static/KaTeX_Caligraphic-Bold.*.woff (New) 7.72kB 7.72kB 100.0% 🚀
static/KaTeX_Caligraphic-Regular.*.woff (New) 7.66kB 7.66kB 100.0% 🚀
static/KaTeX_Size3-Regular.*.ttf (New) 7.59kB 7.59kB 100.0% 🚀
static/KaTeX_Caligraphic-Bold.*.woff2 (New) 6.91kB 6.91kB 100.0% 🚀
static/KaTeX_Caligraphic-Regular.*.woff2 (New) 6.91kB 6.91kB 100.0% 🚀
static/KaTeX_Size1-Regular.*.woff (New) 6.5kB 6.5kB 100.0% 🚀
static/KaTeX_Size2-Regular.*.woff (New) 6.19kB 6.19kB 100.0% 🚀
static/KaTeX_Size4-Regular.*.woff (New) 5.98kB 5.98kB 100.0% 🚀
static/KaTeX_Size1-Regular.*.woff2 (New) 5.47kB 5.47kB 100.0% 🚀
static/KaTeX_Size2-Regular.*.woff2 (New) 5.21kB 5.21kB 100.0% 🚀
static/KaTeX_Size4-Regular.*.woff2 (New) 4.93kB 4.93kB 100.0% 🚀
static/KaTeX_Size3-Regular.*.woff (New) 4.42kB 4.42kB 100.0% 🚀
static/KaTeX_Size3-Regular.*.woff2 (New) 3.62kB 3.62kB 100.0% 🚀
code-high-light.js (Deleted) -2.79MB 0 bytes -100.0% 🗑️

Copy link
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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/x/components/sender/useSpeech.ts (1)

40-68: 缺少 useEffect 依赖项

useEffect 的依赖数组中缺少 allowSpeech。当 allowSpeech 在对象类型和非对象类型之间切换时(例如从 true 变为 { recording: false, onRecordingChange: ... }),Effect 不会重新执行,导致可能出现以下问题:

  1. 从非对象切换到对象时,权限监听器不会被清理
  2. 从对象切换到非对象时,权限检查不会被启动

应用以下修改来添加缺失的依赖项:

       };
     }
-  }, []);
+  }, [allowSpeech]);
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 59b9416 and 3fc6192.

📒 Files selected for processing (1)
  • packages/x/components/sender/useSpeech.ts (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). (4)
  • GitHub Check: size
  • GitHub Check: build preview
  • GitHub Check: test
  • GitHub Check: Cloudflare Pages

@github-actions
Copy link
Contributor

github-actions bot commented Nov 30, 2025

size-limit report 📦

Path Size
packages/x/dist/antdx.min.js 55.39 KB (+5 B 🔺)
packages/x-sdk/dist/x-sdk.min.js 7.29 KB
packages/x-markdown/dist/x-markdown.min.js 50.77 KB
packages/x-markdown/dist/plugins/code-high-light.min.js 317.77 KB
packages/x-markdown/dist/plugins/latex.min.js 61.95 KB
packages/x-markdown/dist/plugins/mermaid.min.js 885.67 KB

@cloudflare-workers-and-pages
Copy link

cloudflare-workers-and-pages bot commented Nov 30, 2025

Deploying ant-design-x with  Cloudflare Pages  Cloudflare Pages

Latest commit: 90b6884
Status: ✅  Deploy successful!
Preview URL: https://fa0a5c8c.ant-design-x.pages.dev
Branch Preview URL: https://fixsender.ant-design-x.pages.dev

View logs

Copy link
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 3fc6192 and 9519ea7.

⛔ Files ignored due to path filters (2)
  • packages/x/components/sender/__tests__/__snapshots__/demo-extend.test.ts.snap is excluded by !**/*.snap
  • packages/x/components/sender/__tests__/__snapshots__/demo.test.ts.snap is excluded by !**/*.snap
📒 Files selected for processing (1)
  • packages/x/components/sender/demo/suffix.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). (5)
  • GitHub Check: build preview
  • GitHub Check: size
  • GitHub Check: test
  • GitHub Check: test
  • GitHub Check: Cloudflare Pages

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

codecov bot commented Nov 30, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.09%. Comparing base (59b9416) to head (90b6884).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1398      +/-   ##
==========================================
+ Coverage   94.04%   94.09%   +0.05%     
==========================================
  Files         144      144              
  Lines        3710     3710              
  Branches     1041     1041              
==========================================
+ Hits         3489     3491       +2     
+ Misses        219      217       -2     
  Partials        2        2              

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

@kimteayon kimteayon changed the title feat: fix sender speech disable fix: fix sender speech disable Nov 30, 2025
@kimteayon kimteayon merged commit 3054510 into main Nov 30, 2025
16 checks passed
@kimteayon kimteayon deleted the fixsender branch November 30, 2025 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working lgtm This PR has been approved by a maintainer

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Sender 的语音输入按钮在安卓某些 webview 版本(如钉钉内部的浏览器环境)下会被禁用

3 participants