Skip to content
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

Interaction between v-scope and v-if not correct (regression from 2.5.x) #9725

Closed
patrickas opened this issue Mar 17, 2019 · 1 comment
Closed

Comments

@patrickas
Copy link

patrickas commented Mar 17, 2019

Version

2.6.8

Reproduction link

http://jsfiddle.net/1pyxu5ch/1/

Steps to reproduce

The fiddle contains two parts.

Part 1 is the old working syntax.

Part 2 is the commented out new syntax that does not work anymore. Un-commenting this part triggers the error.

What is expected?

template is only included when the condition is true

What is actually happening?

syntax error


The fiddle uses 2.6.9 from https://unpkg.com/vue@2.6.9/dist/vue.js but I could not find that version in the drop down so I put 2.6.8 instead.

This was actually originally reported in issue #9658 for 2.6.8 and fixed in 781c705 but it seems the fix is not enough since the issue is still happening.

Filing as a regression since the old functionality will be discontinued in future releases.

@yyx990803
Copy link
Member

Note: this the expected behavior when using the new syntax (I forgot to clarify this in the commit that fixed #9658)

  • When using the new syntax, v-if on <template v-slot> has a higher priority. Conceptually, this v-if determines whether the slot is passed to the child, and has no access the the slot scope.

  • The solution is to use an additional <template v-if> inside the slot, which is more explicit.

grolu added a commit to gardener/dashboard that referenced this issue May 25, 2020
…sion in Vue 2.6

The new v-slot directive, does not provide access to the slotProps to use in an v-if to overwrite the slot conditionally and have the default (fallback) slot content rendered otherwise.
See also these related issues:
vuejs/vue#10784
vuejs/vue#9725
vuejs/vue#9658
grolu added a commit to gardener/dashboard that referenced this issue May 26, 2020
* Ensure that member roles currently not supported by the dashboard don't get lost when updating a member
Fixed autofocus for some dialogs

* changes as discussed

* revert

* Fix secret access in slots

* Revert "Fix secret access in slots"

This reverts commit 90cc626.

* Fixed secret page, had to move code to parent component due to regression in Vue 2.6
The new v-slot directive, does not provide access to the slotProps to use in an v-if to overwrite the slot conditionally and have the default (fallback) slot content rendered otherwise.
See also these related issues:
vuejs/vue#10784
vuejs/vue#9725
vuejs/vue#9658
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants