Skip to content

fix(compiler-core): using v-once inside template with v-if error #7730

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

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

baiwusanyu-c
Copy link
Member

close #7725

@baiwusanyu-c baiwusanyu-c changed the title feat(compiler-core): using v-once inside template with v-if error fix(compiler-core): using v-once inside template with v-if error Feb 17, 2023
@vercel
Copy link

vercel bot commented Apr 6, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated (UTC)
sfc-playground ⬜️ Ignored (Inspect) Apr 6, 2023 0:44am

@github-actions
Copy link

github-actions bot commented Sep 28, 2023

Size Report

Bundles

File Size Gzip Brotli
runtime-dom.global.prod.js 100 kB 37.7 kB 33.9 kB
vue.global.prod.js 159 kB (+20 B) 57.6 kB (+5 B) 51.2 kB (-61 B)

Usages

Name Size Gzip Brotli
createApp 55.2 kB 21.2 kB 19.4 kB
createSSRApp 59.1 kB 22.9 kB 20.9 kB
defineCustomElement 59.9 kB 22.8 kB 20.7 kB
overall 68.9 kB 26.3 kB 23.9 kB

Comment on lines 298 to +301
const ret = (firstChild as ElementNode).codegenNode as
| BlockCodegenNode
| MemoExpression
const vnodeCall = getMemoedVNodeCall(ret)
const vnodeCall = getMemoedOrOnceVNodeCall(ret)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering about the casting of ret. Should that also include CacheExpression?

I realise this would lead to type changes being needed elsewhere, but the incorrect casting may be hiding further bugs.

const {
root,
node: { codegenNode },
} = parseWithIfTransform(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The parseWithIfTransform does not contain transformOnce inside, which makes the resulting snap look unreasonable, and does not contain v-once related code.
Let's pass transformOnce to parseWithIfTransform to make the snap more sense.

baiwusanyu-c and others added 2 commits September 5, 2024 15:57
Copy link

pkg-pr-new bot commented Sep 5, 2024

Open in Stackblitz

@vue/compiler-core

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

@vue/compiler-dom

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

@vue/compiler-ssr

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

@vue/compiler-sfc

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

@vue/runtime-core

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

@vue/reactivity

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

@vue/runtime-dom

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

@vue/shared

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

@vue/server-renderer

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

@vue/compat

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

vue

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

commit: 220e3f1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Needs Review
Development

Successfully merging this pull request may close these issues.

Template compilation fails when using v-once inside template with v-if
3 participants