refactor(antd6): clear residual v6 deprecations - #61
Merged
Merged
Conversation
antd 6.6.5 在运行时对三类 API 发出 deprecated 警告,本次全部清除:
- List → Listy(22 个文件 / 30 处):dataSource→items、renderItem→itemRender、
显式 rowKey;List.Item / List.Item.Meta / actions 按 v6 迁移指引在 itemRender
内以普通 JSX 重组(新增共享组件 ListyItem / ListyMeta,行内边距常量见
listyPadding.ts,按 token 还原 List 默认 12/0 与 small 8/16 的密度);
loading 以内容外层 Spin 等价还原;locale.emptyText 改为条件渲染 Empty;
bordered 以语义 styles 还原;ConversationSidebar 的行样式选择器同步改为
.ant-listy-item(is-active 高亮经 :has() 作用于行外壳)。
- InputNumber/Input addonAfter/addonBefore → Space.Compact + Space.Addon
(SearchCard、WebFormMemoryDialog);LLMConfigCard 的「获取可用模型」按钮
拆为外层无 name Form.Item + 内层 noStyle Form.Item + htmlFor,保持
label↔input 关联(SettingsPage 测试 getByLabelText("模型名称") 依赖它)。
- Dropdown.Button → Space.Compact + Button + Dropdown(JobsPage,placement
保持 Dropdown.Button 默认的 bottomRight)。
测试:GeneralResumeSection 用例行作用域选择器 closest("li") 同步改为
closest(".ant-listy-item")(Listy 行外壳为 div,作用域语义不变,断言未放松)。
验证:vitest 801/801 通过(123 文件);eslint 0 error / 11 warning(基线);
tsc --noEmit 通过;rolldown-vite build 通过;vite dev 冒烟通过。
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.
背景
#53 迁移 antd 6 时搁置的残余弃用清理。基于 antd 6.6.5 源码核实,运行时存在三类 deprecated 警告(
devUseWarning实证):List/List.Item/List.Item.MetaThe List component is deprecated…please use Listy insteadInput/InputNumberaddonAfter/addonBeforedeprecated: addonAfter, please use Space.Compact insteadSpace.Compact+Space.Addon(官方 "Compact Style" / "Search box" 示例)Dropdown.Buttondeprecated: Dropdown.Button, please use Space.Compact + Dropdown + ButtonSpace.Compact+Dropdown+Button(官方 "Button with dropdown menu" 示例)改动清单
1. List → Listy(22 个文件 / 30 处)
dataSource→items、renderItem→itemRender,并补上 Listy 必需的显式rowKey(rc-listy 的useItemKey对 undefined rowKey 会得到item[undefined],产生重复 key)。List.Item/List.Item.Meta/actions:按官方 FAQ「preset structures 在 itemRender 内以普通 JSX 重组」:frontend/src/components/common/ListyItem.tsx(主内容 + 右侧 actions 的 flex 行布局,覆盖原 List.Item 的 onClick / className / style / aria-label 场景);ListyMeta覆盖 Meta 的 avatar / title / description;listyPadding.ts按 antd token 数值还原 List 默认(12/0)与size="small"(8/16)的密度。loading→ 内容外层<Spin spinning>(与原 List 内部<Spin {...loadingProp}>结构等价);locale.emptyText→ 条件渲染Empty;bordered→ 语义styles.root边框 +borderRadiusLG(token 取值);itemLayout="horizontal"(默认值)与style maxHeight+overflowY→ Listy 原生height。ConversationSidebar侧栏 CSS 同步:.ant-list-item→.ant-listy-item,「当前对话」高亮经:has(.is-active)作用到行外壳(jsdom 不验样式,仅视觉层)。涉及文件:InterviewExperiencePanel、InterviewReviewPanel、JobAnalysisModal、JobMatchBatchPanel、ReferralPanel、ReminderPanel、ResumeSuggestionsModal、GeneralResumeSection、DatasetsCard、LLMConfigCard、LLMConfigRecordsCard、NavigationSettingsCard、SkillsCard、CalendarView、WebFormPendingPanel、ConversationSidebar、DrillPage、HomePage、InterviewPage。
2. addonAfter/addonBefore → Space.Compact(3 处)
SearchCard:InputNumber addonAfter="条"→Space.Compact+Space.Addon。WebFormMemoryDialog:Input addonBefore="字段名称"→Space.Compact block+Space.Addon(textbox 数量与顺序不变)。LLMConfigCard:模型名称输入框的「获取可用模型」按钮原来靠addonAfter同时保住 value 绑定与 label↔input 关联(原注释记录了这一约束)。改为:外层无 name 的Form.Item(label/tooltip/htmlFor)+ 内层noStyle Form.Item(把id="model"与 value 注回输入框)+Space.Compact block。SettingsPage.test的getByLabelText("模型名称")继续通过。3. Dropdown.Button → Space.Compact + Dropdown + Button(1 处)
JobsPage「AI 分析适配度」:主按钮 onClick、右键按钮RobotOutlined图标、disabled联动、默认 hover 触发与bottomRightplacement(Dropdown.Button 内部默认值)全部保持。4. 测试适配(逐条说明,断言未放松)
GeneralResumeSection.test.tsx:title.closest("li")→title.closest(".ant-listy-item")。原断言用行外壳元素限定「通用简历 / 求职意向」的查找作用域;Listy 的行外壳由<li>变为.ant-listy-item(div),作用域语义不变。其余 800 个用例零改动通过。验证
vitest run:123 文件 / 801 用例全绿eslint .:0 error / 11 warning(存量基线,无新增)tsc --noEmit:通过rolldown-vite build:通过(32.97s)vite dev冒烟:通过(5199 端口,迁移页面模块均 200)