Skip to content

refactor(settings): one expandable row component, not two - #2141

Merged
jackwener merged 1 commit into
mainfrom
pr-dedupe-expandable-row-13
Aug 4, 2026
Merged

refactor(settings): one expandable row component, not two#2141
jackwener merged 1 commit into
mainfrom
pr-dedupe-expandable-row-13

Conversation

@jackwener

Copy link
Copy Markdown
Member

Task #149ExpandableSettingRow 去重(#141 合入后按约定开)。

改了什么

provider-connection-detail.tsx 里的本地 ExpandableSettingRow 删掉,两处调用换成 kit 的 SettingsExpandableRow净 -50 行。

顺带白拿到的:本地那份早就修了模板的「链接当 trigger」,但从来没有焦点管理,所以密钥行和服务地址行是这个界面上唯二保存/取消后不把焦点还给 trigger 的设置行。现在有了。

两个 swap 必须接住的细节

  1. 分隔线:本地组件自己尾随一个 <Divider />,kit 把横线交给行组。改到调用点画,rule-row-rule-row-rule 的序列不变
  2. 保存按钮不再改名成「保存中…」:kit 的 Save 走 clickAction(自带 spinner)。核过 save() 内部没有 confirm,所以没有 PR-SETTINGS-SHELL-OWNS-LAYOUT-0: shell owns page chrome; bordered rows #137 那个 transition 死锁风险。

验证

typecheck 0 / lint / format:check / check-dead-css / test:checks / providers + settings e2e。

providers.spec.ts:256「keeps each settled row to its own field on a provider that has two」原样通过 —— 那正是这两行存在的意义。

前后截图(收起/展开)已发任务线程:行略微更紧凑、拿到 Item 的标签样式和缩进 —— 这就是采用共享组件的含义,不是回归。

providers.spec.ts:71 是离线环境专属失败(网络错误 toast 在 500px 视口遮住删除按钮),与干净 main 上一模一样。

@maka-审美专家 请 review。

provider-connection-detail carried its own ExpandableSettingRow, written
before the kit had one. It goes; the two rows use SettingsExpandableRow.

The local copy had already fixed the template's link-as-trigger, but never
gained focus management or the SettingsRow/SettingsField vocabulary, so the
key and endpoint rows were the only settings rows on the surface that did
not return focus to their trigger on Save or Cancel. They do now, for free.

Two details the swap had to carry:

- the local component trailed its own `<Divider />`; the kit leaves rules to
  the row group. The call site draws them, so the rule-row-rule-row-rule
  sequence is unchanged.
- Save no longer renames itself to 保存中… . clickAction owns that now, and
  `save()` opens no confirm, so the transition is safe here.

providers.spec's "keeps each settled row to its own field on a provider that
has two" passes untouched — that is the behaviour these rows exist for.

Verified: typecheck, lint, format:check, check-dead-css, test:checks,
providers + settings e2e, and captures of the detail page in both states.
The row is slightly more compact and picks up the Item label treatment and
inset, which is what adopting the shared component means. providers.spec:71
fails offline-only (a network-error toast covers the delete button in the
500px viewport), identically to clean main.
@jackwener

Copy link
Copy Markdown
Member Author

Review by maka-审美专家 — 通过:单文件净 -50 行,本地 ExpandableSettingRow 删除、两处换 kit 组件,无兼容层(按测试期反过度设计约束)。白拿的焦点管理修复(密钥/服务地址行是此前唯二不还焦点的行)、Divider 归行组画保住 rule-row-rule 序列、保存钮不再改名。改后行略紧凑=向 Item 方言收敛而非回归,截图三张核过可接受。providers.spec:256(双行独立字段契约)原样通过。CI 绿。合入。

@jackwener
jackwener merged commit 2892d12 into main Aug 4, 2026
11 checks passed
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.

1 participant