Skip to content

Conversation

@Ilanaya
Copy link

@Ilanaya Ilanaya commented Jul 2, 2024

Fixes #7910
Related #1731, #2910 comment

Explanation:

Generated render function uses with statement to wrap its contents in some conditions. Example:

image

As _ctx is a Proxy inside with statement, it, on the first time, traps access to Symbol.unscopables and only then the actual property. You can see that ProxyHandlers get Symbol.unscopables as the key on the screenshot below:

image

To reproduce these steps you can place a debugger in the warning message in the Stackblitz reproduction.

Why this should be fixed

This warning is unrelated to user code and makes lots of noise when a compiled template has a lot of proxy property access

StackBlitz Reproduction

Simple HTML page reproduction:

Test.html
<script src="../../dist/vue.global.js"></script>
<script src="../../../compiler-dom/dist/compiler-dom.global.js"></script>

<div id="demo">
</div>

<script>
  Vue.createApp({
    setup() {
      const inlineTemplateString = `<div> {{ state.text }} </div>`;
      const { code } = VueCompilerDOM.compile(inlineTemplateString);

      return new Function('Vue', code)(Vue);
    },
    computed: {
      state() {
        return {
          text: 123,
        };
      },
    },
  }).mount('#demo');
</script>  

@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 8, 2024

Open in Stackblitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-sfc

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

@vue/compiler-ssr

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

@vue/reactivity

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

@vue/runtime-dom

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

@vue/runtime-core

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

@vue/server-renderer

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

@vue/shared

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

vue

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

@vue/compat

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

commit: 03ea8ff

@github-actions
Copy link

github-actions bot commented Oct 8, 2024

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 101 kB (+33 B) 38.1 kB (+8 B) 34.2 kB (+21 B)
vue.global.prod.js 160 kB (+33 B) 58 kB (+7 B) 51.6 kB (+49 B)

Usages

Name Size Gzip Brotli
createApp (CAPI only) 49.1 kB (+33 B) 18.9 kB (+16 B) 17.3 kB (+10 B)
createApp 55.7 kB (+33 B) 21.4 kB (+14 B) 19.6 kB (-33 B)
createSSRApp 59.7 kB (+33 B) 23.2 kB (+18 B) 21.1 kB (+28 B)
defineCustomElement 60.5 kB (+33 B) 23 kB (+11 B) 21 kB (+71 B)
overall 69.4 kB (+33 B) 26.5 kB (+14 B) 24.2 kB (+88 B)

@edison1105
Copy link
Member

for more details see #2910 (comment)

@edison1105 edison1105 added need guidance The approach/solution in the PR is unclear and requires guidance from maintainer to proceed further. ready for review This PR requires more reviews 🍰 p2-nice-to-have Priority 2: this is not breaking anything but nice to have it addressed. labels Oct 8, 2024
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. need guidance The approach/solution in the PR is unclear and requires guidance from maintainer to proceed further. ready for review This PR requires more reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Warning using compile() in render() on method calls

2 participants