Skip to content

compiler-dom create unexpected nodes with v-for + v-slot #3498

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

Closed
johnsoncodehk opened this issue Mar 28, 2021 · 4 comments
Closed

compiler-dom create unexpected nodes with v-for + v-slot #3498

johnsoncodehk opened this issue Mar 28, 2021 · 4 comments
Labels
need guidance The approach/solution in the PR is unclear and requires guidance from maintainer to proceed further.

Comments

@johnsoncodehk johnsoncodehk changed the title compiler-dom create invalid nodes with v-for + v-slot compiler-dom create unexpected nodes with v-for + v-slot Mar 28, 2021
@HcySunYang
Copy link
Member

This seems to be intentional. With or without v-slot determines whether it needs to be processed by the vFor transform, so in essence, they are treated differently. We can see the details here https://github.com/vuejs/vue-next/blob/master/packages/compiler-core/src/transform.ts#L463-L465

@johnsoncodehk
Copy link
Member Author

johnsoncodehk commented Mar 29, 2021

Can we change this implement if this is not the design?

@HcySunYang
Copy link
Member

This should be by design, we need @yyx990803 input.

@HcySunYang HcySunYang added the need guidance The approach/solution in the PR is unclear and requires guidance from maintainer to proceed further. label Mar 31, 2021
@yyx990803
Copy link
Member

<template v-for="..." v-slot> generates code like createSlots({ ... }) since it's dynamically generated slots. In this case the codegen tree is the source of truth and the original AST is left untouched. We can technically adjust the behavior, but it will solely be for external tooling and actually risks breaking existing compiler logic. I think it's better to keep the behavior and special case it in Volar.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
need guidance The approach/solution in the PR is unclear and requires guidance from maintainer to proceed further.
Projects
None yet
Development

No branches or pull requests

3 participants