Skip to content

refactor(web): aggregate ConversationPane and Sidebar props into view-models#986

Open
wbxl2000 wants to merge 3 commits into
mainfrom
refactor/web-conversation-vm
Open

refactor(web): aggregate ConversationPane and Sidebar props into view-models#986
wbxl2000 wants to merge 3 commits into
mainfrom
refactor/web-conversation-vm

Conversation

@wbxl2000

Copy link
Copy Markdown
Collaborator

Related Issue

N/A — internal refactor, no user-facing behavior change.

Problem

App.vue drilled dozens of client fields into ConversationPane.vue (~50 props) and Sidebar.vue (~10 props) one by one. The wide prop surfaces made the components hard to maintain: adding or renaming a field meant touching the parent, the child's prop list, and every usage site.

What changed

Pure structure refactor — no runtime behavior change; component templates and emit contracts are unchanged.

  • ConversationPane.vue: collapsed ~42 props into two — vm: ConversationVm (39 view-data fields) and actions: ConversationActions (searchFiles, uploadImage, loadOlderMessages). All 34 emits unchanged.
  • Sidebar.vue: collapsed 9 props into two — vm: SidebarVm (8 client-derived fields) and colWidth (kept separate; it is layout state, not from client). All 13 emits unchanged.
  • App.vue builds conversationVm / sidebarVm as computed objects mapped one-for-one from the same sources it passed before, plus a stable conversationActions object.
  • New type files: conversationVmTypes.ts, sidebarVmTypes.ts.

The child components read fields via props.vm.x (reactivity preserved; props.vm is never destructured), so behavior and re-render timing are identical to before.

Verified with typecheck, test (26), build, and oxlint (0 errors) after each subtree.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my feature works. (N/A — pure refactor; no component-test infra in apps/kimi-web. Covered by typecheck + existing pure-logic tests.)
  • Ran gen-changesets skill, or this PR needs no changeset. (Patch on @moonshot-ai/kimi-code; @moonshot-ai/kimi-web is ignored and bundled into the CLI.)
  • Ran gen-docs skill, or this PR needs no doc update. (No user-facing behavior change.)

@changeset-bot

changeset-bot Bot commented Jun 22, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e9ba559

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@moonshot-ai/kimi-code Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Jun 22, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@e9ba559
npx https://pkg.pr.new/@moonshot-ai/kimi-code@e9ba559

commit: e9ba559

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