Skip to content

v-if is executed even when v-for doesnt iterate anything #2014

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
Fuzzyma opened this issue Aug 31, 2020 · 2 comments
Closed

v-if is executed even when v-for doesnt iterate anything #2014

Fuzzyma opened this issue Aug 31, 2020 · 2 comments

Comments

@Fuzzyma
Copy link

Fuzzyma commented Aug 31, 2020

Version

3.0.0-rc.9

Reproduction link

https://codesandbox.io/s/amazing-feistel-udure?file=/src/App.vue

Steps to reproduce

Open the link and open the console.

Alternatively put an v-if on an element with v-for which iterates through an empty array and throw an error in the v-if computed property or call debugger.

What is expected?

The error should not be thrown (or the debugger statement not beeing executed)

What is actually happening?

The error is thrown


It seems that v-if is evaluated even though v-for was passed an empty array and hence has nothing to iterate over.

The docs say, that v-for is evaluated first and that's how it was in vue 2 but somehow this behavior changed.

PS: I am aware, that for that exact reason you shouldn't use both on an element. However, it should still work!

@skirtles-code
Copy link
Contributor

Related: #1165.

@posva
Copy link
Member

posva commented Aug 31, 2020

See #1165 (comment)

@posva posva closed this as completed Aug 31, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Nov 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants