refactor: 提示与确认框改用 App 上下文实例
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
CI / Static checks (push) Has been cancelled
CI / Production build (push) Has been cancelled
CI / API integration (push) Has been cancelled
CI / Taro builds (acheng-campus-food) (push) Has been cancelled
CI / Taro builds (atelier-solopreneur) (push) Has been cancelled
CI / Taro builds (linjing-editorial) (push) Has been cancelled
CI / Browser regression (push) Has been cancelled
This commit is contained in:
1 parent
3a0099e674
commit
06619a191f
22 files changed
+167
-27
No files matched your search
@@ -0,0 +1,48 @@
|
||||
# 0034 Ant Design 6 弃用项收口
|
||||
|
||||
- 状态:已采纳
|
||||
- 日期:2026-10-21
|
||||
|
||||
## Context
|
||||
|
||||
Admin 升级到 Ant Design 6.6 后,开发态控制台持续出现弃用提示:
|
||||
|
||||
- `Alert.message` 已改名为 `title`。
|
||||
- `Space.direction` 已改名为 `orientation`。
|
||||
- 静态 `message.*` 与 `Modal.confirm` 无法读取 `ConfigProvider` 的动态主题上下文。
|
||||
- `List` 标记为 deprecated,官方建议 6.6+ 改用 `Listy`。
|
||||
|
||||
这些提示不影响功能,但会淹没真正有价值的新警告,也让后续升级到 Ant Design 7 时缺少明确清单。
|
||||
|
||||
## Decision
|
||||
|
||||
1. `Alert` 统一使用 `title`;正文仍用 `description`。
|
||||
2. `Space` 统一使用 `orientation`。
|
||||
3. 所有提示与确认框改为 `App.useApp()` 取得的实例:
|
||||
- 组件与自定义 hook 在函数体首部声明 `const { message } = App.useApp();`。
|
||||
- 确认框改为 `const { modal } = App.useApp();` 后调用 `modal.confirm`。
|
||||
- 删除 `components/AdminMessage.ts` 这一静态转出口,避免再次绕过上下文。
|
||||
4. 暂不迁移 `List` → `Listy`:
|
||||
- `Listy` 是虚拟滚动列表,API 与 `List` 不兼容(需要 `itemHeight`、`renderItem` 等)。
|
||||
- 当前 `List` 仅用于审计日志、失败计数和模板模块清单等小数据量场景,最大条数受分页或模板规模限制。
|
||||
- 用 `Listy` 替换属于渲染行为变更,需要单独的可视回归,不应混在机械迁移里。
|
||||
|
||||
## Alternatives
|
||||
|
||||
- 保留静态 `message` / `Modal.confirm`:提示不继承动态主题,且 Ant Design 7 会移除,拒绝。
|
||||
- 用自建单例桥接 `App` 上下文:等于重新发明静态 API,并引入第二种提示模式,拒绝。
|
||||
- 本轮直接把 `List` 换成 `Listy`:改动面大、收益低,且缺少分页与固定高度语义,推迟。
|
||||
|
||||
## Consequences
|
||||
|
||||
- Admin 源码不再出现 `Alert.message`、`Space.direction`、静态 `message` 和 `Modal.confirm`。
|
||||
- 提示与确认框跟随 `ConfigProvider` 主题与国际化。
|
||||
- `List` 的弃用提示仍会出现在开发态控制台,作为已知技术债登记。
|
||||
- 触发迁移 `List` → `Listy` 的条件:Ant Design 7 升级,或某个 `List` 数据源增长到需要虚拟滚动的规模。
|
||||
|
||||
## Migration plan
|
||||
|
||||
1. 机械迁移 `Alert` 与 `Space` 属性,跑 `typecheck`、`lint`、`test`、`build`。
|
||||
2. 把静态提示 API 改为 `App.useApp()`,删除静态转出口。
|
||||
3. 用 Admin 浏览器回归验证创建品牌、页面方案和会话过期提示流程。
|
||||
4. 升级 Ant Design 7 前重新评估 `List` 的使用点。
|
||||
Reference in new issue
Block a user