fix(assets): 过滤未发布的草稿角色 - #174
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Found two performance regressions in the new full-catalog loading path; inline comments contain the actionable details.
Verification: reviewed the locked range 2231b9ae527921e61b638284a8bf1285fca0390b...9b5fa75c2b27f1db2973a4542c604bc5ac04232d. Focused tests/typecheck could not be rerun because the mounted frontend dependencies are unavailable (vitest was not executable and the package modules were absent).
| void Promise.allSettled([ | ||
| projectApis.get(projectId), | ||
| characterApis.listByProject(projectId, { page: 1, pageSize: 1 }), | ||
| loadAllCharactersByProject(characterApis, projectId), |
There was a problem hiding this comment.
High: setProject still runs only after Promise.allSettled completes, but this second promise now downloads every Character page (including each nested outfit/action/frame tree). As a result, every project route—including a direct Character detail—stays on 正在读取项目… until the full catalog scan finishes; the asset-library route also starts another full scan in its child. Please render the project as soon as projectApis.get resolves and load the published count independently/in the background (or obtain the count without fetching every asset).
| if (active) setError('资产库暂时无法读取') | ||
| }, | ||
| ) | ||
| void loadAllCharactersByProject(characterApis, projectId).then( |
There was a problem hiding this comment.
Medium: Because pageNumber remains in this effect's dependency list, every next/previous-page click calls loadAllCharactersByProject again and redownloads the entire Character catalog before slicing 24 items. Pagination therefore performs O(all characters) network work and shows the loading state on every click. Fetch/cache the published list when projectId changes and paginate that state locally, or keep filtering/pagination on the server.
…publication-contract # Conflicts: # frontend/src/pages/project-detail/index.test.tsx
变更说明
依据
当前后端 Character 没有明确的草稿/已发布字段,
status也没有发布语义。因此本 PR 暂以“至少存在一条包含真实帧的动作”作为前端发布判定。后端补充正式字段后,只需替换isPublishedCharacter这一处规则。验证
npm run typechecknpm run lint -- --deny-warningsnpm test -- --run:24 个测试文件、148 项测试通过npm run buildgit diff --check范围
仅修改 Character 实体、资产库和项目详情 7 个前端文件;不包含后端、WorkflowRun、生成流程或构建产物。