Skip to content

fix(compiler-core): fix for :key shorthand patchflag - #10939

Closed
Doctor-wu wants to merge 1 commit into
vuejs:mainfrom
Doctor-wu:fix-for-key-shorthand
Closed

Doctor-wu wants to merge 1 commit into
vuejs:mainfrom
Doctor-wu:fix-for-key-shorthand

Conversation

@Doctor-wu

Copy link
Copy Markdown
Member

close #10882

@github-actions

Copy link
Copy Markdown

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 90.7 kB 34.5 kB 31.1 kB
vue.global.prod.js 148 kB (+6 B) 53.7 kB (+2 B) 48.1 kB (+46 B)

Usages

Name Size Gzip Brotli
createApp 50.8 kB 19.9 kB 18.1 kB
createSSRApp 54.1 kB 21.2 kB 19.3 kB
defineCustomElement 53.1 kB 20.6 kB 18.8 kB
overall 64.5 kB 24.9 kB 22.6 kB

@quiteeasy

Copy link
Copy Markdown
Contributor

In this PR, we lose the actual reference to the .exp property from the :key resolved in transformElement.ts within the returned function. As a result, the keyProperty injected as a prop in the vFor.ts exit function no longer references the actual expression of keyProp.

This change introduces bugs when we set :key on a <template> element, as the :key is not correctly attached to its children, same for other elements, they have a wrong .exp reference.

To address this issue, I have opened a PR that properly resolves the :key shorthand. Please review the PR and share your thoughts. Thank you.

@quiteeasy quiteeasy 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.

check #10942

@yyx990803 yyx990803 closed this in 29425df Jun 4, 2024
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.

:key shorthand incorrectly compiles to UNKEYED_FRAGMENT

2 participants