Skip to content

fix(web): 修复「选择同步渠道」打开弹窗时页面卡死 - #6651

Open
Rain-kl wants to merge 1 commit into
QuantumNous:mainfrom
Rain-kl:fix/upstream-ratio-sync-ui-freeze
Open

fix(web): 修复「选择同步渠道」打开弹窗时页面卡死#6651
Rain-kl wants to merge 1 commit into
QuantumNous:mainfrom
Rain-kl:fix/upstream-ratio-sync-ui-freeze

Conversation

@Rain-kl

@Rain-kl Rain-kl commented Aug 4, 2026

Copy link
Copy Markdown

⚠️ 提交说明 / PR Notice

📝 变更描述 / Description

现象:在「系统设置 → 模型定价 → 上游价格同步」点击选择同步渠道** 时,浏览器主线程卡死,弹窗打不开, 界面无响应。

根因:弹窗表格每行使用 Base UI Select,其内容 Portal 到 body,与 Dialog 的 modal 焦点陷阱冲突,打开时主线程被拖死。

修复:

  1. endpoint 列改为原生 <select>,不再使用带 Portal 的 Base UI Select
  2. 渠道选择 Dialog 仅在打开时挂载

范围: 纯前端,2 个文件;无后端改动。

🚀 变更类型 / Type of change

  • 🐛 Bug 修复 (Bug fix)
  • ✨ 新功能 (New feature)
  • ⚡ 性能优化 / 重构 (Refactor)
  • 📝 文档更新 (Documentation)

🔗 关联任务 / Related Issue

#6650

✅ 提交前检查项 / Checklist

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

📸 运行证明 / Proof of Work

复现(修复前):
模型定价 → 上游价格同步 → 点击「选择同步渠道」→ 页面卡死。

验证(修复后):
同上步骤 → 弹窗立即出现;可搜索/分页/勾选/改 Sync Endpoint/确认。

image ---

Summary by CodeRabbit

  • Refactor
    • Simplified the sync endpoint selector by replacing a custom component with a native HTML select element, reducing unnecessary imports and code complexity.
    • Optimized component mounting behavior for improved performance by conditionally mounting the channel selector dialog only when needed.

Base UI Select portals outside the dialog and fights the modal focus
trap, freezing the page when opening the channel picker. Use a native
<select> for the sync endpoint column, and mount the dialog only while
open.
Copilot AI lite review requested due to automatic review settings August 4, 2026 13:32
@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 4813246c-24ed-42b1-8741-efbc80bade3e

📥 Commits

Reviewing files that changed from the base of the PR and between 0ab0202 and db7061a.

📒 Files selected for processing (2)
  • web/src/features/system-settings/models/channel-selector-dialog.tsx
  • web/src/features/system-settings/models/upstream-ratio-sync.tsx

Walkthrough

The channel selector now uses a native HTML <select>. The dialog mounts only when channelDialogOpen is true. Endpoint options, selected values, callbacks, and custom endpoint input behavior remain unchanged.

Changes

Channel selector dialog

Layer / File(s) Summary
Update channel selector dialog behavior
web/src/features/system-settings/models/channel-selector-dialog.tsx, web/src/features/system-settings/models/upstream-ratio-sync.tsx
The endpoint selector now renders with native HTML. ChannelSelectorDialog mounts only while channelDialogOpen is true.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related issues

Possibly related PRs

Suggested reviewers: copilot

Poem

A rabbit selects an endpoint with care,
A native dropdown waits there.
The dialog mounts when called,
And rests when closed and stalled.
“Hop!” says the rabbit, “The flow is fair.”

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed 标题明确描述了修复打开“选择同步渠道”弹窗时页面卡死这一主要变更。
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ 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.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses a frontend UI freeze when opening the “Select Sync Channels” dialog in System Settings → Model Pricing → Upstream Price Sync, caused by a Portal-based Select conflicting with the Dialog’s modal focus trap.

Changes:

  • Replace the per-row Base UI Select (Portal-to-body) with a native <select> for the “Sync Endpoint” column.
  • Mount ChannelSelectorDialog only while it is open to avoid initializing the heavy dialog/table when closed.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
web/src/features/system-settings/models/upstream-ratio-sync.tsx Conditionally mounts the channel selector dialog only when opened.
web/src/features/system-settings/models/channel-selector-dialog.tsx Replaces Portal-based Select with native <select> and adds an aria-label for accessibility.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +230 to +234
<select
className='border-input bg-background h-8 w-32 shrink-0 rounded-md border px-2 text-sm'
value={endpointType}
onValueChange={(v) => v !== null && handleTypeChange(v)}
onChange={(e) => handleTypeChange(e.target.value)}
aria-label={t('Sync Endpoint')}
@Calcium-Ion
Calcium-Ion force-pushed the main branch 2 times, most recently from 51fdfc5 to 2b6f1df Compare August 30, 2026 15:03
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