Skip to content

fix(frontend): avoid subtask render state mutation#3157

Open
Gujiassh wants to merge 1 commit into
bytedance:mainfrom
Gujiassh:fix/3147-avoid-render-state-mutation-20260522
Open

fix(frontend): avoid subtask render state mutation#3157
Gujiassh wants to merge 1 commit into
bytedance:mainfrom
Gujiassh:fix/3147-avoid-render-state-mutation-20260522

Conversation

@Gujiassh
Copy link
Copy Markdown
Contributor

Summary

Fixes #3147.

This removes subtask state writes from the MessageList render path:

  • computes rendered subtask snapshots from grouped messages with useMemo
  • syncs those snapshots to the subtask context from useEffect
  • updates subtask context through functional immutable state updates instead of mutating the existing tasks object
  • keeps SubtaskCard renderable on the first frame with a fallback task snapshot before context sync completes

Validation

From frontend/:

  • pnpm install --frozen-lockfile
  • pnpm exec prettier --check src/core/tasks/context.tsx src/components/workspace/messages/message-list.tsx src/components/workspace/messages/subtask-card.tsx tests/unit/core/tasks/context.test.ts
  • pnpm exec vitest run tests/unit/core/tasks/context.test.ts tests/unit/core/tasks/subtask-result.test.ts
  • pnpm exec eslint src/core/tasks/context.tsx src/components/workspace/messages/message-list.tsx src/components/workspace/messages/subtask-card.tsx tests/unit/core/tasks/context.test.ts
  • pnpm exec tsc --noEmit
  • git diff --check

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.

Follow-up: avoid mutating subtask state during render

1 participant