Skip to content

feat(keys/cc-switch-dialog): 修复自定义cc-switch名称失焦后重置问题 - #5170

Merged
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
GnezIew:feat-cc-switch
May 29, 2026
Merged

feat(keys/cc-switch-dialog): 修复自定义cc-switch名称失焦后重置问题#5170
Calcium-Ion merged 1 commit into
QuantumNous:mainfrom
GnezIew:feat-cc-switch

Conversation

@GnezIew

@GnezIew GnezIew commented May 29, 2026

Copy link
Copy Markdown
Contributor

⚠️ 提交说明 / PR Notice

Important

  • 请提供人工撰写的简洁摘要,避免直接粘贴未经整理的 AI 输出。

📝 变更描述 / Description

(简述:做了什么?为什么这样改能生效?请基于你对代码逻辑的理解来写,避免粘贴未经整理的内容)
问题阐述:用户输入的文字只存在于组件内部的 searchValue 状态中,因为 allowCustomValue 为 false ,这些文字 从未同步到父组件的 name state 。失焦后内部状态清空,显示就恢复成了父组件持有的旧值。
在 cc-switch-dialog.tsx 的 Name 输入框上加 allowCustomValue={true} ,在 cc-switch-dialog.tsx 的 Name 输入框上加 allowCustomValue={true} :

🚀 变更类型 / Type of change

  • [✅] 🐛 Bug 修复 (Bug fix) - 请关联对应 Issue,避免将设计取舍、理解偏差或预期不一致直接归类为 bug
  • ✨ 新功能 (New feature) - 重大特性建议先通过 Issue 沟通
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

✅ 提交前检查项 / Checklist

  • [✅] 人工确认: 我已亲自整理并撰写此描述,没有直接粘贴未经处理的 AI 输出。
  • [✅] 非重复提交: 我已搜索现有的 IssuesPRs,确认不是重复提交。
  • [✅] Bug fix 说明: 若此 PR 标记为 Bug fix,我已提交或关联对应 Issue,且不会将设计取舍、预期不一致或理解偏差直接归类为 bug。
  • [✅] 变更理解: 我已理解这些更改的工作原理及可能影响。
  • [✅] 范围聚焦: 本 PR 未包含任何与当前任务无关的代码改动。
  • [✅] 本地验证: 已在本地运行并通过测试或手动验证,维护者可以据此复核结果。
  • [✅] 安全合规: 代码中无敏感凭据,且符合项目代码规范。

📸 运行证明 / Proof of Work

(请在此粘贴截图、关键日志或测试报告,以证明变更生效)
image

Summary by CodeRabbit

  • New Features
    • Name field now accepts custom user-provided entries in addition to predefined options.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 29, 2026

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6836d501-aeeb-4aab-89c3-dc5eef9ed318

📥 Commits

Reviewing files that changed from the base of the PR and between e8c836d and 6ec3534.

📒 Files selected for processing (1)
  • web/default/src/features/keys/components/dialogs/cc-switch-dialog.tsx

Walkthrough

The CCSwitchDialog component now enables custom name entry in the Name ComboboxInput field by setting allowCustomValue={true}, allowing users to input and persist arbitrary names instead of only selecting from predefined options.

Changes

Custom CC Switch Names

Layer / File(s) Summary
Allow custom name input in CC switch dialog
web/default/src/features/keys/components/dialogs/cc-switch-dialog.tsx
The ComboboxInput component for the Name field now accepts custom user-provided values by enabling allowCustomValue={true}.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A rabbit hops with glee,
Custom names now flow so free,
Type what you please with care,
The CC switch label's yours to share! 🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ 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%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title describes fixing a CC Switch name reset issue on blur, which matches the primary code change enabling custom input persistence.
Linked Issues check ✅ Passed The code change (allowCustomValue={true}) directly addresses issue #5162 by enabling custom name input persistence to prevent loss on blur.
Out of Scope Changes check ✅ Passed The single-line change is narrowly scoped to the specific issue, enabling custom input on the Name field without unrelated modifications.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 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 and usage tips.

@Calcium-Ion
Calcium-Ion merged commit 38bf2d8 into QuantumNous:main May 29, 2026
2 checks passed
shudonglin added a commit to rayward-external/new-api that referenced this pull request Jun 1, 2026
* chore(repo): ignore playwright mcp artifacts

* perf(form): focus first validation error on submit

- scope validation queries with a form root id so feedback stays inside the submitted form.
- scroll to the earliest invalid control or message and move focus without fighting scroll position.
- avoid handling the same failed submit twice to keep retries from jumping unexpectedly.

* feat(keys/cc-switch-dialog): 修复自定义cc-switch名称失焦后重置问题 (QuantumNous#5170)

* feat: add subscription balance redemption toggle (QuantumNous#3071)

---------

Co-authored-by: QuentinHsu <xuquentinyang@gmail.com>
Co-authored-by: 同語 <133845290+t0ng7u@users.noreply.github.com>
Co-authored-by: zengwei <51938905+GnezIew@users.noreply.github.com>
Co-authored-by: CaIon <i@caion.me>
Co-authored-by: Claude <noreply@anthropic.com>
@coderabbitai coderabbitai Bot mentioned this pull request Jul 15, 2026
11 tasks
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.

CC切换名称无法输入

2 participants