-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
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
baiwusanyu-c
wants to merge
33
commits into
vuejs:main
Choose a base branch
from
baiwusanyu-c:bwsy/fix/vOnceAndvIf
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+52
−6
Open
Changes from all commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
15a59e4
feat(compiler-core): using v-once inside template with v-if error
baiwusanyu-c ef2a903
feat(compiler-core): update code
baiwusanyu-c e5dc332
feat(compiler-core): added unit test
baiwusanyu-c 2126b2c
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 2295fae
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c d2b0ed8
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 23a6584
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c ecfedc1
Merge remote-tracking branch 'origin/main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 1dadc60
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 9889e6e
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 08df85e
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 9aa3972
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 32f77d9
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c ff8ff86
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 05c8659
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 24468f1
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 90695cd
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c c66c49c
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c dd8fe45
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 0697229
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 685e76c
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 5842843
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 941da92
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c eb2296e
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 834654f
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 03c135e
Delete awd.html
baiwusanyu-c dd7dc2c
Merge branch 'main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 3d6b261
Merge remote-tracking branch 'origin/main' into bwsy/fix/vOnceAndvIf
baiwusanyu-c 52da0a4
[autofix.ci] apply automated fixes
autofix-ci[bot] 27dc34c
chore: updaed unit test snap
baiwusanyu-c 5ca1018
chore: updaed unit test snap
baiwusanyu-c fe3d99a
Merge remote-tracking branch 'upstream/main' into bwsy/fix/vOnceAndvIf
220e3f1
[autofix.ci] apply automated fixes
autofix-ci[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,7 +31,12 @@ import { ErrorCodes, createCompilerError } from '../errors' | |
import { processExpression } from './transformExpression' | ||
import { validateBrowserExpression } from '../validateExpression' | ||
import { CREATE_COMMENT, FRAGMENT } from '../runtimeHelpers' | ||
import { findDir, findProp, getMemoedVNodeCall, injectProp } from '../utils' | ||
import { | ||
findDir, | ||
findProp, | ||
getMemoedOrOnceVNodeCall, | ||
injectProp, | ||
} from '../utils' | ||
import { PatchFlagNames, PatchFlags } from '@vue/shared' | ||
|
||
export const transformIf: NodeTransform = createStructuralDirectiveTransform( | ||
|
@@ -294,7 +299,7 @@ function createChildrenCodegenNode( | |
const ret = (firstChild as ElementNode).codegenNode as | ||
| BlockCodegenNode | ||
| MemoExpression | ||
const vnodeCall = getMemoedVNodeCall(ret) | ||
const vnodeCall = getMemoedOrOnceVNodeCall(ret) | ||
Comment on lines
299
to
+302
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm wondering about the casting of I realise this would lead to type changes being needed elsewhere, but the incorrect casting may be hiding further bugs. |
||
// Change createVNode to createBlock. | ||
if (vnodeCall.type === NodeTypes.VNODE_CALL) { | ||
convertToBlock(vnodeCall, context) | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The
parseWithIfTransform
does not containtransformOnce
inside, which makes the resulting snap look unreasonable, and does not contain v-once related code.Let's pass
transformOnce
toparseWithIfTransform
to make the snap more sense.