Skip to content

fix: enable provider group editing in edit user dialog#560

Closed
NieiR wants to merge 2 commits intoding113:devfrom
NieiR:fix/edit-user-provider-group
Closed

fix: enable provider group editing in edit user dialog#560
NieiR wants to merge 2 commits intoding113:devfrom
NieiR:fix/edit-user-provider-group

Conversation

@NieiR
Copy link
Contributor

@NieiR NieiR commented Jan 7, 2026

Summary

Fixes regression from #539 where editing existing users could not modify the provider group field.

Changes

File Change
edit-user-dialog.tsx Always show providerGroup field in edit mode; move modelSuggestions hook after form declaration
user-edit-section.tsx Replace read-only Badge display with editable ProviderGroupSelect component

Root Cause

PR #539 introduced two issues:

  1. showUserProviderGroup = Boolean(user.providerGroup?.trim()) - field hidden when user had no providerGroup
  2. UserEditSection displayed providerGroup as read-only Badges instead of editable input

Test Plan

  • TypeCheck passes
  • Lint passes
  • Manual test: edit user without providerGroup → field now visible and editable
  • Manual test: edit user with providerGroup → can modify value

Greptile Summary

Fixes regression from PR #539 that prevented editing the providerGroup field in the edit user dialog.

Root cause analysis:

  • showUserProviderGroup = Boolean(user.providerGroup?.trim()) hid the field when users had no existing providerGroup
  • UserEditSection displayed providerGroup as read-only Badges instead of an editable input

Changes made:

  • Always show providerGroup field in edit mode by setting showProviderGroup: true
  • Moved useModelSuggestions hook after form declaration to react to currentUserDraft.providerGroup changes
  • Replaced read-only Badge display with editable ProviderGroupSelect component in user-edit-section.tsx

Impact:

  • Users can now add/modify provider groups on existing users
  • Model suggestions dynamically update when provider group changes

Confidence Score: 5/5

  • This PR is safe to merge - it's a straightforward bug fix with minimal changes
  • The changes are minimal, focused, and directly address the identified regression. Both issues are fixed correctly: the visibility condition is removed and the read-only display is replaced with an editable component. The hook reordering ensures model suggestions update reactively.
  • No files require special attention

Important Files Changed

Filename Overview
src/app/[locale]/dashboard/_components/user/edit-user-dialog.tsx Fixed providerGroup field visibility and moved modelSuggestions hook to use current form values
src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx Replaced read-only Badge display with editable ProviderGroupSelect component

Sequence Diagram

sequenceDiagram
    participant User
    participant EditUserDialog
    participant useModelSuggestions
    participant UserEditSection
    participant ProviderGroupSelect
    participant Server

    User->>EditUserDialog: Open edit dialog
    EditUserDialog->>EditUserDialog: Always show providerGroup (showProviderGroup=true)
    EditUserDialog->>EditUserDialog: Read currentUserDraft.providerGroup
    EditUserDialog->>useModelSuggestions: Fetch models for current providerGroup
    useModelSuggestions->>Server: getModelSuggestionsByProviderGroup(providerGroup)
    Server-->>useModelSuggestions: Return model suggestions
    EditUserDialog->>UserEditSection: Render with editable providerGroup
    UserEditSection->>ProviderGroupSelect: Render editable select (not Badges)
    User->>ProviderGroupSelect: Change providerGroup value
    ProviderGroupSelect->>UserEditSection: onChange("providerGroup", newValue)
    UserEditSection->>EditUserDialog: handleUserChange("providerGroup", newValue)
    EditUserDialog->>EditUserDialog: Update form.values
    EditUserDialog->>useModelSuggestions: Re-fetch with new providerGroup
    useModelSuggestions->>Server: getModelSuggestionsByProviderGroup(newProviderGroup)
    Server-->>useModelSuggestions: Return updated suggestions
    User->>EditUserDialog: Submit form
    EditUserDialog->>Server: editUser(userId, formData)
    Server-->>EditUserDialog: Success
    EditUserDialog->>User: Show success toast
Loading

- Always show providerGroup field in edit mode (was hidden when user had no providerGroup)
- Replace read-only Badge display with editable ProviderGroupSelect component
- Move modelSuggestions hook after form declaration to support dynamic updates

Regression from ding113#539
@coderabbitai
Copy link

coderabbitai bot commented Jan 7, 2026

📝 Walkthrough

Walkthrough

编辑对话框的 providerGroup 字段在编辑模式下始终显示;将 modelSuggestions 的来源改为基于 currentUserDraft.providerGroup;将 providerGroup 的 UI 从 Badge 切换为 ProviderGroupSelect 并扩展相关翻译键与类型定义。

Changes

Cohort / File(s) 变更概要
对话框逻辑调整
src/app/[locale]/dashboard/_components/user/edit-user-dialog.tsx
移除基于原始用户的条件显示,硬编码在编辑模式下显示 providerGroup;将 modelSuggestions hook 移到 currentUserDraft 计算之后并改为使用 currentUserDraft.providerGroup
表单 UI 与类型
src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx
ProviderGroupSelect 替换 Badge/逗号列表渲染;保留通过 emitChange("providerGroup", ...) 的值流;更新组件 props/翻译类型以将 providerGroup 从简字符串扩展为包含 label/placeholder/providersSuffix/tagInputErrors/errors 的对象。
i18n 文档(多语言)
messages/en/dashboard.json, messages/ja/dashboard.json, messages/ru/dashboard.json, messages/zh-CN/dashboard.json, messages/zh-TW/dashboard.json
为 providerGroup 选择器新增 providerGroupSelect 块,包含 providersSuffixloadFailed 文本。
翻译 Hook 扩展
src/app/[locale]/dashboard/_components/user/hooks/use-user-translations.ts
扩展 UserEditTranslations.providerGroup,新增 providersSuffixtagInputErrors(包含 empty/duplicate/too_long/invalid_format/max_tags)与 errors.loadFailed;新增 tUi = useTranslations("ui.tagInput") 并将其纳入 memo 依赖。

Estimated code review effort

🎯 3 (中等) | ⏱️ ~20 分钟

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 33.33% 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
Title check ✅ Passed 标题清晰准确地描述了主要变更:修复用户编辑对话框中提供商组字段的编辑功能,这是PR的核心目标。
Description check ✅ Passed 描述充分关联到变更集,详细说明了根本原因、具体修复、测试计划和影响,与代码变更内容一致。

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @NieiR, 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 regression that prevented the modification of the 'providerGroup' field when editing existing user profiles. The changes ensure that the 'providerGroup' field is consistently displayed and fully editable within the user management interface, enhancing the overall user experience for administrators.

Highlights

  • Provider Group Editing Enabled: The ability to edit the 'providerGroup' field within the user edit dialog has been restored, fixing a regression.
  • Consistent Field Visibility: The 'providerGroup' field is now always visible in the user edit dialog, even if the user initially has no provider group assigned.
  • Interactive Input Component: The read-only display of the 'providerGroup' using badges has been replaced with an interactive 'ProviderGroupSelect' component, allowing direct modification.
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.

@github-actions github-actions bot added bug Something isn't working area:UI labels Jan 7, 2026
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 successfully addresses a regression where the provider group for a user could not be edited. The changes correctly ensure the provider group field is always visible in the edit dialog and replace the read-only display with the editable ProviderGroupSelect component. Additionally, the useModelSuggestions hook has been refactored to react to changes in the form's state, which is a good improvement. I've identified one medium-severity issue regarding missing translations for the new component, which could impact user experience by showing untranslated error messages.

@github-actions github-actions bot added the size/XS Extra Small PR (< 50 lines) label Jan 7, 2026
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 (2)
src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx (1)

414-422: 验证默认值行为是否符合预期

ProviderGroupSelect 组件的使用正确地修复了回归问题,使 providerGroup 字段可编辑。但需要注意:

  • 第 415 行使用 user.providerGroup || PROVIDER_GROUP.DEFAULT 作为回退值
  • 而 schema 中 providerGroup 定义为 nullable().optional()(edit-user-dialog.tsx 第 39 行)
  • 如果 normalizeProviderGroup 返回 null/empty,但 UI 显示 DEFAULT,可能会导致用户困惑(显示值与实际存储值不一致)

请确认这个默认值回退是否符合业务逻辑要求,或者是否应该允许显示空值/占位符。

另外,disabled={false} 是明确的但不是必需的(false 是默认值),可以考虑移除以简化代码:

♻️ 可选的代码简化
             <ProviderGroupSelect
               value={user.providerGroup || PROVIDER_GROUP.DEFAULT}
               onChange={(val) => emitChange("providerGroup", val)}
-              disabled={false}
               translations={{
                 label: translations.fields.providerGroup.label,
                 placeholder: translations.fields.providerGroup.placeholder,
               }}
             />
src/app/[locale]/dashboard/_components/user/edit-user-dialog.tsx (1)

228-228: 明确传递 showProviderGroup 属性

显式传递 showProviderGroup 属性确保 providerGroup 字段在编辑模式下始终显示,与第 76 行的意图一致。

可选:由于该值始终为 true,可以考虑使用简写形式以提高可读性:

♻️ 可选的代码简化
-            showProviderGroup
+            showProviderGroup={true}

或者如果定义一个常量:

+            showProviderGroup

但当前的明确写法也完全可以接受。

📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to Reviews > Disable Cache setting

📥 Commits

Reviewing files that changed from the base of the PR and between c622705 and 51e8779.

📒 Files selected for processing (2)
  • src/app/[locale]/dashboard/_components/user/edit-user-dialog.tsx
  • src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (CLAUDE.md)

Use 2-space indentation in all code files

Files:

  • src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx
  • src/app/[locale]/dashboard/_components/user/edit-user-dialog.tsx
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Use double quotes for strings instead of single quotes
Use trailing commas in multi-line structures
Enforce maximum line length of 100 characters
Use path alias @/* to reference files from ./src/* directory

**/*.{ts,tsx,js,jsx}: Use Biome for linting and formatting with 2-space indent, double quotes, trailing commas, and 100 character max line length
Use path alias @/* to reference files in ./src/* directory

Files:

  • src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx
  • src/app/[locale]/dashboard/_components/user/edit-user-dialog.tsx
src/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.{tsx,jsx}: Use lucide-react for icons, no custom SVGs
Use React's automatic escaping to prevent XSS vulnerabilities

Files:

  • src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx
  • src/app/[locale]/dashboard/_components/user/edit-user-dialog.tsx
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use TypeScript strict mode for type safety
Use readonly or const assertions for immutable data structures

Files:

  • src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx
  • src/app/[locale]/dashboard/_components/user/edit-user-dialog.tsx
**/*.{tsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Use next-intl for internationalization with 5 locales: en, ja, ru, zh-CN, zh-TW

Files:

  • src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx
  • src/app/[locale]/dashboard/_components/user/edit-user-dialog.tsx
🧠 Learnings (2)
📚 Learning: 2026-01-03T09:08:49.019Z
Learnt from: CR
Repo: ding113/claude-code-hub PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-03T09:08:49.019Z
Learning: Applies to src/components/**/*.{tsx,jsx} : Use shadcn/ui component library for high-quality, accessible UI components

Applied to files:

  • src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx
📚 Learning: 2026-01-05T03:02:06.594Z
Learnt from: NieiR
Repo: ding113/claude-code-hub PR: 539
File: src/app/[locale]/dashboard/_components/user/user-key-table-row.tsx:66-66
Timestamp: 2026-01-05T03:02:06.594Z
Learning: In the claude-code-hub project, the translations.actions.addKey field in UserKeyTableRowProps is defined as optional for backward compatibility, but all actual callers in the codebase provide the complete translations object. The field has been added to all 5 locale files (messages/{locale}/dashboard.json).

Applied to files:

  • src/app/[locale]/dashboard/_components/user/edit-user-dialog.tsx
⏰ 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: pr-review
  • GitHub Check: Greptile Review
  • GitHub Check: pr-description
  • GitHub Check: Docker Build Test
🔇 Additional comments (3)
src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx (1)

25-25: 导入语句正确

正确导入了 ProviderGroupSelect 组件以替换之前的只读 Badge 显示。

src/app/[locale]/dashboard/_components/user/edit-user-dialog.tsx (2)

75-76: 正确修复了 providerGroup 字段隐藏问题

此修改修复了从 PR #539 引入的回归问题。之前使用 Boolean(user.providerGroup?.trim()) 作为条件,当用户的 providerGroup 为空时会隐藏该字段,导致无法在编辑模式下设置或修改 providerGroup。

现在始终显示 providerGroup 字段,这是编辑对话框的正确行为。


126-128: 优秀的改进:模型建议现在响应实时更改

useModelSuggestions 移至表单声明之后,并使用 currentUserDraft.providerGroup 而不是原始的 user.providerGroup,这是一个很好的改进:

  • Hook 调用顺序仍然正确(所有 hooks 在顶层按一致顺序调用)
  • 现在模型建议会根据用户在表单中选择的 provider group 实时更新,而不是基于原始值
  • 这提供了更好的用户体验,使表单更具交互性

Copy link
Contributor

@github-actions github-actions 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 Summary

No significant issues identified in this PR. The changes correctly fix the regression from #539 by always showing the providerGroup field and replacing the read-only Badge display with the editable ProviderGroupSelect component.

PR Size: XS

  • Lines changed: 36 (16 additions + 20 deletions)
  • Files changed: 2

Review Coverage

  • Logic and correctness - Clean
  • Security (OWASP Top 10) - Clean
  • Error handling - Clean
  • Type safety - Clean
  • Documentation accuracy - Clean
  • Test coverage - Manual testing documented in PR
  • Code clarity - Good

Automated review by Claude AI

Copy link
Contributor

@github-actions github-actions 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 Summary

No significant issues identified in this PR. The changes correctly fix the regression from #539 by always showing the providerGroup field and replacing the read-only Badge display with the editable ProviderGroupSelect component.

PR Size: XS

  • Lines changed: 36 (16 additions + 20 deletions)
  • Files changed: 2

Review Coverage

  • Logic and correctness - Clean
  • Security (OWASP Top 10) - Clean
  • Error handling - Clean
  • Type safety - Clean
  • Documentation accuracy - Clean
  • Test coverage - Manual testing documented in PR
  • Code clarity - Good

Automated review by Claude AI

…ialog

Pass full translations object to ProviderGroupSelect including:
- tagInputErrors for validation messages (empty, duplicate, too_long, etc.)
- errors.loadFailed for API error handling
- providersSuffix for provider count display

This fixes untranslated error messages when users input invalid provider group tags.
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/app/[locale]/dashboard/_components/user/hooks/use-user-translations.ts (1)

139-149: 将硬编码的最大长度值提取为常量。

第 143 行的 max: 50 在代码中多处重复出现(edit-key-form.tsx、add-key-form.tsx、user-form.tsx 等文件中均有相同的硬编码值,以及 Zod 验证模式中的 .max(50))。建议在文件顶部定义常量统一管理,便于后续维护。

♻️ 建议的重构方案

在文件顶部定义常量:

 "use client";

 import { useTranslations } from "next-intl";
 import { useMemo } from "react";

+// 供应商分组标签配置
+const PROVIDER_GROUP_TAG_MAX_LENGTH = 50;
+
 export interface UserEditTranslations {

然后在第 143 行使用该常量:

               tagInputErrors: {
                 empty: tUi("emptyTag"),
                 duplicate: tUi("duplicateTag"),
-                too_long: tUi("tooLong", { max: 50 }),
+                too_long: tUi("tooLong", { max: PROVIDER_GROUP_TAG_MAX_LENGTH }),
                 invalid_format: tUi("invalidFormat"),
                 max_tags: tUi("maxTags"),
               },
📜 Review details

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Cache: Disabled due to Reviews > Disable Cache setting

📥 Commits

Reviewing files that changed from the base of the PR and between 51e8779 and e66e5fb.

📒 Files selected for processing (7)
  • messages/en/dashboard.json
  • messages/ja/dashboard.json
  • messages/ru/dashboard.json
  • messages/zh-CN/dashboard.json
  • messages/zh-TW/dashboard.json
  • src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx
  • src/app/[locale]/dashboard/_components/user/hooks/use-user-translations.ts
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/app/[locale]/dashboard/_components/user/forms/user-edit-section.tsx
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx,js,jsx,json}

📄 CodeRabbit inference engine (CLAUDE.md)

Use 2-space indentation in all code files

Files:

  • messages/zh-TW/dashboard.json
  • messages/ru/dashboard.json
  • messages/ja/dashboard.json
  • messages/zh-CN/dashboard.json
  • messages/en/dashboard.json
  • src/app/[locale]/dashboard/_components/user/hooks/use-user-translations.ts
messages/**/*.json

📄 CodeRabbit inference engine (CLAUDE.md)

Support 5 locales via next-intl: en, ja, ru, zh-CN, zh-TW with messages in messages/{locale}/*.json

Store message translations in messages/{locale}/*.json files

Files:

  • messages/zh-TW/dashboard.json
  • messages/ru/dashboard.json
  • messages/ja/dashboard.json
  • messages/zh-CN/dashboard.json
  • messages/en/dashboard.json
**/*.{tsx,json}

📄 CodeRabbit inference engine (AGENTS.md)

Use next-intl for internationalization with 5 locales: en, ja, ru, zh-CN, zh-TW

Files:

  • messages/zh-TW/dashboard.json
  • messages/ru/dashboard.json
  • messages/ja/dashboard.json
  • messages/zh-CN/dashboard.json
  • messages/en/dashboard.json
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.{ts,tsx,js,jsx}: Use double quotes for strings instead of single quotes
Use trailing commas in multi-line structures
Enforce maximum line length of 100 characters
Use path alias @/* to reference files from ./src/* directory

**/*.{ts,tsx,js,jsx}: Use Biome for linting and formatting with 2-space indent, double quotes, trailing commas, and 100 character max line length
Use path alias @/* to reference files in ./src/* directory

Files:

  • src/app/[locale]/dashboard/_components/user/hooks/use-user-translations.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use TypeScript strict mode for type safety
Use readonly or const assertions for immutable data structures

Files:

  • src/app/[locale]/dashboard/_components/user/hooks/use-user-translations.ts
src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

src/**/*.ts: Hash API keys using SHA-256 before storing in database, never store plaintext keys
Mask API keys and sensitive data in application logs
Validate required environment variables at startup with clear error messages

Files:

  • src/app/[locale]/dashboard/_components/user/hooks/use-user-translations.ts
src/app/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Implement Content-Security-Policy headers for XSS prevention

Files:

  • src/app/[locale]/dashboard/_components/user/hooks/use-user-translations.ts
🧠 Learnings (4)
📓 Common learnings
Learnt from: NieiR
Repo: ding113/claude-code-hub PR: 539
File: src/app/[locale]/dashboard/_components/user/user-key-table-row.tsx:66-66
Timestamp: 2026-01-05T03:02:06.594Z
Learning: In the claude-code-hub project, the translations.actions.addKey field in UserKeyTableRowProps is defined as optional for backward compatibility, but all actual callers in the codebase provide the complete translations object. The field has been added to all 5 locale files (messages/{locale}/dashboard.json).
📚 Learning: 2026-01-05T03:02:06.594Z
Learnt from: NieiR
Repo: ding113/claude-code-hub PR: 539
File: src/app/[locale]/dashboard/_components/user/user-key-table-row.tsx:66-66
Timestamp: 2026-01-05T03:02:06.594Z
Learning: In the claude-code-hub project, the translations.actions.addKey field in UserKeyTableRowProps is defined as optional for backward compatibility, but all actual callers in the codebase provide the complete translations object. The field has been added to all 5 locale files (messages/{locale}/dashboard.json).

Applied to files:

  • messages/ja/dashboard.json
  • messages/zh-CN/dashboard.json
  • src/app/[locale]/dashboard/_components/user/hooks/use-user-translations.ts
📚 Learning: 2026-01-03T09:08:20.573Z
Learnt from: CR
Repo: ding113/claude-code-hub PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-01-03T09:08:20.573Z
Learning: Applies to messages/**/*.json : Support 5 locales via next-intl: en, ja, ru, zh-CN, zh-TW with messages in `messages/{locale}/*.json`

Applied to files:

  • messages/ja/dashboard.json
  • messages/zh-CN/dashboard.json
📚 Learning: 2026-01-05T03:01:39.354Z
Learnt from: NieiR
Repo: ding113/claude-code-hub PR: 539
File: src/types/user.ts:158-170
Timestamp: 2026-01-05T03:01:39.354Z
Learning: In TypeScript interfaces, explicitly document and enforce distinct meanings for null and undefined. Example: for numeric limits like limitTotalUsd, use 'number | null | undefined' when null signifies explicitly unlimited (e.g., matches DB schema or special UI logic) and undefined signifies 'inherit default'. This pattern should be consistently reflected in type definitions across related fields to preserve semantic clarity between database constraints and UI behavior.

Applied to files:

  • src/app/[locale]/dashboard/_components/user/hooks/use-user-translations.ts
🧬 Code graph analysis (1)
src/app/[locale]/dashboard/_components/user/hooks/use-user-translations.ts (1)
scripts/sync-settings-keys.js (1)
  • t (72-72)
⏰ 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: Docker Build Test
🔇 Additional comments (8)
messages/ru/dashboard.json (1)

1340-1343: providerGroupSelect 俄文文案与现有结构保持一致,LGTM

providersSuffix 与下方 providerGroup.providerCount 的用法一致(“провайдеров”),loadFailed 也与其它错误提示风格统一,JSON 结构与缩进正确,无需调整。

messages/ja/dashboard.json (1)

1329-1332: providerGroupSelect 日文翻译自然且与现有键兼容

providersSuffixproviderGroup.providerCount 一致(“件のプロバイダー”),loadFailed 采用项目中常见的“〜に失敗しました”表述,结构与缩进也都正确,可以直接使用。

messages/zh-TW/dashboard.json (1)

1338-1341: 繁體中文 providerGroupSelect 鍵值與現有字串對齊,LGTM

providersSuffixproviderGroup.providerCount 的量詞與名詞完全一致(“個供應商”),loadFailed 也沿用本檔案的「載入…失敗」風格,結構與縮排正確。

messages/en/dashboard.json (1)

1367-1370: 英文 providerGroupSelect 補全正確,與現有結構一致

providersSuffix: "providers" 與下方 providerGroup.providerCount 的用法保持一致,loadFailed 也沿用現有「Failed to …」錯誤訊息風格,JSON 結構無誤。

messages/zh-CN/dashboard.json (1)

1368-1371: 简体中文 providerGroupSelect 词条补充完整且语义正确

providersSuffixproviderGroup.providerCount 中的“{count} 个供应商”保持一致,loadFailed 也符合本文件一贯的错误提示风格,JSON 结构无问题。

src/app/[locale]/dashboard/_components/user/hooks/use-user-translations.ts (3)

29-39: 类型定义结构正确。

新增的 providersSuffixtagInputErrorserrors 字段定义合理,所有字段都标记为可选,与父级 providerGroup? 字段的可选性保持一致。这种嵌套的可选结构符合 TypeScript 最佳实践。


112-112: 正确使用独立的翻译命名空间。

为可复用的 ui.tagInput 组件引入独立的翻译命名空间是合理的设计,有助于组件在不同上下文中复用。Hook 调用顺序符合 React 规则。


213-213: 正确更新了 memo 依赖项。

依赖数组已正确更新为包含新增的 tUi hook,确保当翻译命名空间变化时能够正确重新计算。所有使用的值都已包含在依赖项中,符合 React useMemo 最佳实践。

@ding113
Copy link
Owner

ding113 commented Jan 7, 2026

The user edit form itself does not allow modifying the provider group field. This logic was established in #424
The intent is to prevent users from mistakenly changing the provider group and causing unexpected behavior.

@ding113 ding113 closed this Jan 7, 2026
@github-project-automation github-project-automation bot moved this from Backlog to Done in Claude Code Hub Roadmap Jan 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:UI bug Something isn't working size/XS Extra Small PR (< 50 lines)

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants