Skip to content

fix(assets): 过滤未发布的草稿角色 - #174

Open
xyh202131 wants to merge 3 commits into
1024XEngineer:mainfrom
xyh202131:fix/project-assets-publication-contract
Open

fix(assets): 过滤未发布的草稿角色#174
xyh202131 wants to merge 3 commits into
1024XEngineer:mainfrom
xyh202131:fix/project-assets-publication-contract

Conversation

@xyh202131

Copy link
Copy Markdown
Contributor

变更说明

  • 资产库不再展示尚无真实动作帧的草稿 Character
  • 项目侧栏的角色数量只统计已经形成可用动作资产的角色
  • 先完整读取 Character 分页数据,再执行发布过滤和前端分页,避免草稿占据服务端页位后隐藏后续正式资产
  • 将发布判定和完整分页读取收口到 Character 实体入口,资产库与项目详情复用同一规则

依据

当前后端 Character 没有明确的草稿/已发布字段,status 也没有发布语义。因此本 PR 暂以“至少存在一条包含真实帧的动作”作为前端发布判定。后端补充正式字段后,只需替换 isPublishedCharacter 这一处规则。

验证

  • npm run typecheck
  • npm run lint -- --deny-warnings
  • npm test -- --run:24 个测试文件、148 项测试通过
  • npm run build
  • 7 个变更文件格式检查通过
  • git diff --check

范围

仅修改 Character 实体、资产库和项目详情 7 个前端文件;不包含后端、WorkflowRun、生成流程或构建产物。

@vercel

vercel Bot commented Aug 9, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
windup Ready Ready Preview Aug 10, 2026 7:33am

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant