fix(sidechat): keep the rc line's reconnect label via a documented shim

0.1.6-alpha.2 removed ConnectionIndicator's reconnectLabel, but the peer range
(^0.1.5-rc.1) still covers the rc line, where the prop is REQUIRED and renders
the retry button's hover/focus action text. Widening the component type once
keeps both lines correct: rc renders the label, alpha.2 ignores the extra key.
The shim carries a comment naming the condition for deleting it.
This commit is contained in:
Menghuan1918
2026-09-27 22:18:19 +08:00
parent 3e4da566d8
commit 221e955c6b
2 changed files with 20 additions and 3 deletions
@@ -16,7 +16,7 @@
|---|---|---|---|
| 1 | **移除** `IconSendOutline16`(该版本唯一被移除的图标;新增 7 个) | `SideChatView` 编译失败 | 换成 `IconSendOutline14`(编译器建议的继任者) |
| 2 | `TerminalBlockLabels` **新增必需字段 `noExitCode: string`**(语义:命令结束时拿不到退出码——被未知信号终止或从未启动) | 标签对象类型不符 | 补 `noExitCode` 并新增词条 `sideChatBlockNoExitCode`(20 份词典同步) |
| 3 | `ConnectionIndicator` **移除 `reconnectLabel`**(停用态文案本身已命名重连动作) | 传了不存在的 prop | 删掉该 prop;`sideChatConnReconnect` 词条保留(20 份词典已存在,删除是 20 文件噪声,留待上游回归或后续清理) |
| 3 | `ConnectionIndicator` **移除 `reconnectLabel`**(停用态文案本身已命名重连动作) | 传了不存在的 prop | **跨线兼容 shim**:rc 线里该 prop 是必需且是重连按钮的 hover/焦点动作文案,peer 范围仍覆盖 rc,因此把组件类型加宽一次(`ConnectionIndicatorCompat`)并继续传该 prop——rc 渲染它、alpha.2 忽略多余键(`src/client/SideChatView.tsx` 有注释说明何时删掉这个 shim) |
| 4 | `Menu` / `Modal`:**仅文档 + 键盘语义细化**(Tab 在列表内 settle、Escape 归属、菜单打开时 Escape 先给菜单) | 无类型破坏 | 不改代码;e2e/harness 覆盖既有交互 |
| 5 | `index.d.ts` 新增导出:`Checkbox`、`isDarwinDesktop`、`MarkdownDelegateProvider`/`MarkdownDelegate`/`MarkdownExternalLinkHandler`、`UserTextReferences`;模块新增 `SiteGlyph` | 纯增量 | 不使用,不改代码 |
| 6 | `dsh-tools` 在本线**不再 peer `dsh-code-runtime`** | 旧 hoist 失去理由,且上游从未发布该包 alpha.2 | **从 devDependencies 删除 `dsh-code-runtime`**(保留会造出「22 个 alpha.2 + 1 个 rc.2」的混合树) |
@@ -51,4 +51,5 @@ peer 范围、`dsh.client.inject`、chunk externals 白名单、`SIDEBAR_SERVICE
- **不改 peer 下限**(用户确认):`^0.1.5-rc.1` 继续容纳 rc.1/rc.2 用户;本适配对他们是无感的。
- **不改 README 的版本徽章与安装策略文案**:它们描述的是**已发布**的 v0.19.1("已在 0.1.5-rc.2 上验证"),把分支上的 alpha.2 验证写进去会让已发布版声称未做过的验证。发版时(若该分支进入某个 alpha 版本)再一并更新。
- **不清理 `sideChatConnReconnect`**:上游移除的是 prop 而非该文案的其它用途可能回归,删它要动 20 份词典;留待上游确认。
- **不清理 `sideChatConnReconnect`**:跨线 shim 仍在用它(rc 线必需),删它要动 20 份词典且会让 rc 用户少文案。
- **源码编译需要 alpha.2 的类型**:标签对象里 `noExitCode` 在 rc 线类型上不存在(多余属性会被 TS 拒绝),所以本分支的 `pnpm typecheck` 以 alpha.2 为准;运行时两线都安全(多余键被忽略)。
+17 -1
View File
@@ -73,6 +73,21 @@ import { api } from './api.ts'
import { usePolling } from './use-polling.ts'
import { t } from './locales.ts'
import type { SessionScope } from './api.ts'
import type { ComponentProps, ComponentType } from 'react'
/**
* Cross-line compatibility shim for `ConnectionIndicator`.
*
* 0.1.6-alpha.2 REMOVED the `reconnectLabel` prop (the outage label already
* names the action), while the 0.1.5-rc line still REQUIRES it as the retry
* button's hover/focus action text. The plugin's peer range covers both, so
* the component type is widened once here and the prop is always passed: rc
* renders it, alpha.2 ignores the extra key. Delete this shim (and the prop)
* when the peer floor moves past the rc line.
*/
const ConnectionIndicatorCompat = ConnectionIndicator as unknown as ComponentType<
ComponentProps<typeof ConnectionIndicator> & { reconnectLabel?: string }
>
import type { SidebarTab } from './state.ts'
import css from './SideChatView.module.css'
@@ -753,9 +768,10 @@ export function SideChatView(props: {
</button>
</div>
{connectionState !== undefined && connectionState !== 'connected' && (
<ConnectionIndicator
<ConnectionIndicatorCompat
state={connectionState}
disconnectedLabel={t('sideChatConnDisconnected')}
reconnectLabel={t('sideChatConnReconnect')}
connectingLabel={t('sideChatConnConnecting')}
recoveredLabel={t('sideChatConnRecovered')}
reconnectActionLabel={t('sideChatConnReconnectAction')}