Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(runtime-core): prevent readonly warning when using useTemplateRef with same variable name as template ref #11802

Closed
wants to merge 1 commit into from

Conversation

jh-leong
Copy link
Member

@jh-leong jh-leong commented Sep 4, 2024

close #11795

Copy link

github-actions bot commented Sep 4, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB (+187 B) 37.7 kB (+67 B) 33.9 kB (+24 B)
vue.global.prod.js 159 kB (+187 B) 57.6 kB (+54 B) 51.2 kB (+80 B)

Usages

Name Size Gzip Brotli
createApp 55.2 kB (+62 B) 21.2 kB (+27 B) 19.4 kB (+24 B)
createSSRApp 59.1 kB (+62 B) 22.9 kB (+27 B) 20.8 kB (+28 B)
defineCustomElement 59.9 kB (+62 B) 22.8 kB (+32 B) 20.7 kB (+21 B)
overall 68.9 kB (+62 B) 26.3 kB (+27 B) 23.9 kB (+6 B)

Copy link

pkg-pr-new bot commented Sep 4, 2024

Open in Stackblitz

@vue/compiler-dom

pnpm add https://pkg.pr.new/@vue/compiler-dom@11802

@vue/compiler-core

pnpm add https://pkg.pr.new/@vue/compiler-core@11802

@vue/compiler-ssr

pnpm add https://pkg.pr.new/@vue/compiler-ssr@11802

@vue/compiler-sfc

pnpm add https://pkg.pr.new/@vue/compiler-sfc@11802

@vue/reactivity

pnpm add https://pkg.pr.new/@vue/reactivity@11802

@vue/runtime-dom

pnpm add https://pkg.pr.new/@vue/runtime-dom@11802

@vue/runtime-core

pnpm add https://pkg.pr.new/@vue/runtime-core@11802

@vue/shared

pnpm add https://pkg.pr.new/@vue/shared@11802

@vue/server-renderer

pnpm add https://pkg.pr.new/@vue/server-renderer@11802

vue

pnpm add https://pkg.pr.new/vue@11802

@vue/compat

pnpm add https://pkg.pr.new/@vue/compat@11802

commit: 227bd9b

@edison1105 edison1105 added 🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. ready for review This PR requires more reviews labels Sep 4, 2024
@linzhe141
Copy link
Contributor

linzhe141 commented Sep 4, 2024

If this is the case, Vue will still throw a warning
this pr - playground

I think we should check if it's a templateRef when setRef, but since vue has unref'd the templateRef, we can't determine it anymore

@jh-leong
Copy link
Member Author

jh-leong commented Sep 4, 2024

If this is the case, Vue will still throw a warning this pr - playground

I think we should check if it's a templateRef when setRef, but since vue has unref'd the templateRef, we can't determine it anymore

Good catch @linzhe141 !

However, for this edge case, maybe we could show a warning at compile time (as edison1105 suggested) or let the language tool handle it with a TypeScript error. In fact, the latest version of the language tool already provides warnings for such cases.

@yyx990803 yyx990803 closed this in bc63df0 Sep 4, 2024
@jh-leong jh-leong deleted the fix/11795 branch September 4, 2024 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. ready for review This PR requires more reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Set operation on key "value" failed: target is readonly always warned with useTemplateRef
3 participants