feat(components): 可选组件支持后台下载(dev-board#581) - #806
Merged
Conversation
五个下载入口(首次登录面板 / AI 对话拦截卡 / 设置→组件管理 / 语音 / 录音)原先各自 new 控制器,进度跟着组件实例走:面板一关进度就看不到,换个入口再点还会重复发起。 改为应用级单例 services/componentDownloads.js(工厂 composables/useComponentDownloads.js): 按 packId 共享 item、在途去重、load 合并不覆盖、claim 引用计数——有入口在前台由它交代 结果,转入后台或入口卸载后完成/失败走全局提示。 - 首次登录面板:下载中出现「后台下载」,「稍后再说」/点遮罩在下载中也不中断; - AI 对话拦截卡:下载中可「后台下载」;后台装完仅在此后无新消息且不在生成中时自动重发 原消息,否则提示可重试;顺修同轮重复 component_required 把首张确认卡关掉的旧 bug; - 组件管理 / 语音 / 录音:进入即接上在途进度; - zh-CN / en-US 补 5 个键。 验证:test:optional-components 74/74(新用例先红后绿,三处关键逻辑破坏均转红); check:nav / check:locales / check:emits / build:h5 通过;真渲染走查面板→后台下载→ reLaunch 到组件管理看到同一进度→完成全局提示,23 条断言全过。 Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
问题
dev-board#581:组件下载应该支持后台下载。原先五个下载入口各自持有进度状态,关掉面板就看不到进度,换个入口再点会重复发起。
修法
frontend/src/services/componentDownloads.js(纯工厂composables/useComponentDownloads.js,编排仍复用 useOptionalComponents 的 pack→模型→ensure 顺序):按 packId 共享 item、在途去重、load 合并不覆盖在途/失败状态、claim引用计数决定由前台入口还是全局提示交代结果。component_required会把第一张待确认卡关掉。验证
npm run test:optional-components:74/74(改动前基线 58/58;新用例在旧代码上 ERR_MODULE_NOT_FOUND 转红;去重 / load 合并 / claim 三处逐一破坏均转红,还原后全绿)。check:nav、check:locales、check:emits、build:h5通过。未验证
🤖 Generated with Claude Code