Skip to content

fix(vapor): reconcile keyed JSX map children - #85

Closed
re-thc wants to merge 1 commit into
vuejs:mainfrom
re-thc:vv-fix-5
Closed

re-thc wants to merge 1 commit into
vuejs:mainfrom
re-thc:vv-fix-5

Conversation

@re-thc

@re-thc re-thc commented Oct 11, 2026

Copy link
Copy Markdown
Contributor

Problem

When rendering a list with items.map(item => <Row key={item.id} />), changing the list recreates every row—even when the same keys are still present.

Moving one item therefore rebuilds the whole list. This is slow and causes components to lose their local state.

Fix

Compile supported keyed .map() expressions using the existing v-for list handling. Vue can then move existing rows, update their data, and create or remove only the rows that changed.

Map expressions that need ordinary JavaScript behavior keep using the existing rendering path.

@pkg-pr-new

pkg-pr-new Bot commented Oct 11, 2026

Copy link
Copy Markdown

Open in StackBlitz

@vue-jsx-vapor/compiler-rs

pnpm add https://pkg.pr.new/@vue-jsx-vapor/compiler-rs@85

@vue-jsx-vapor/eslint

pnpm add https://pkg.pr.new/@vue-jsx-vapor/eslint@85

@vue-jsx-vapor/macros

pnpm add https://pkg.pr.new/@vue-jsx-vapor/macros@85

@vue-jsx-vapor/runtime

pnpm add https://pkg.pr.new/@vue-jsx-vapor/runtime@85

vue-jsx-vapor

pnpm add https://pkg.pr.new/vue-jsx-vapor@85

commit: 1446cf8

@zhiyuanzmj

Copy link
Copy Markdown
Member

Thanks for the work, but I don't think we should merge this.

In vapor mode .map() in JSX isn't a supported list path — For is, and keying
is explicit on it:

<VaporFor in={items} getKey={item => item.id}>
  {item => <li>{item.value.name}</li>}
</VaporFor>

@zhiyuanzmj zhiyuanzmj closed this Nov 22, 2026
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.

2 participants