fix(ratio-editor): pass correct prop names to TieredPricingEditor#7
Merged
Conversation
Switching the billing mode radio to "表达式/阶梯计费" was crashing the ModelPricingEditor with React error boundary catching the render exception (showing "页面渲染出错,请刷新页面重试"). Root cause: when PR #5 wired up the tiered_expr UI entry into the feature branch's rewritten ModelPricingEditor, the prop names passed to TieredPricingEditor were guessed (value/onChange/onRequestRuleChange) but the actual component signature is function TieredPricingEditor({ model, onExprChange, requestRuleExpr, onRequestRuleExprChange, t }) so the editor received `model={undefined}`, blew up the moment it tried to read `model.billingExpr` / `model.fixedPrice`, and the error surfaced as a generic boundary fallback. Fix: pass the right names — `model={selectedModel}`, `onExprChange={handleBillingExprChange}`, `onRequestRuleExprChange={handleRequestRuleExprChange}`, and `t={t}`. Verified in browser: - click "表达式/阶梯计费" radio → editor renders cleanly - visualize/expression sub-radio shows up - 7 preset templates render (Flat / Claude Opus 4.6 / GPT-5.4 / Claude Sonnet 4.5 / Qwen3 Max / GLM-4.5 Air / Doubao Seed 1.8) - model list row updates to "阶梯计费 (1 档)"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
修复 PR #5 留下的 follow-up bug:在「分组与模型定价设置 → 模型定价设置」点击"表达式/阶梯计费"radio 会导致页面崩溃(出现"页面渲染出错,请刷新页面重试")。
根因
PR #5 把 `tiered_expr` UI 入口接入 feature 分支重写后的 `ModelPricingEditor` 时,传给 `TieredPricingEditor` 的 props 名字猜错了:
结果 TieredPricingEditor 收到 `model=undefined`,第一次访问 `model.billingExpr` 就抛错,error boundary 接住后展示通用兜底页。
修复
验证
浏览器 dogfood:
构建验证:
其它 follow-up(不在本次范围)
This PR was generated automatically by Cursor
Made with Cursor