Subscribe on changes!

$scopedSlots are missing non-scoped slot functions when using @vue/compat

avatar
Jul 28th 2023

Vue version

3.3.4

Link to minimal reproduction

https://stackblitz.com/edit/js-y4s9r7?file=index.js

Steps to reproduce

  1. Open reproduction
  2. Observe that $slots count and $scopedSlots count is out of sync

What is expected?

$scopedSlots have all available slots, including non-scoped ones

What is actually happening?

$scopedSlots explicitly ignores non-scoped slots (like it was <Vue 2.6)

System Info

No response

Any additional comments?

This behaviour is explicitly added in https://github.com/vuejs/core/commit/7f93c76b9647aba058a2adfe77d8a3fdaa534a91

However, this is not the behaviour of Vue.js 2: see https://stackblitz.com/edit/js-gdxvd8?file=index.js,index.html

I've also explicitly added to the bottom of Vue.js 2 sandbox copy& paste of this test: https://github.com/vuejs/core/blob/main/packages/vue-compat/__tests__/instance.spec.ts#L286-L303 to demonstrate that test also check non-Vue.js 2 behaviour

avatar
Aug 8th 2023

Is this really a vue3 bug, either from the unit tests or from the original commit, I think $scopedSlots will only contain scoped slots, which seems to be intentional, is this a fix logic for the vue2 history issue that makes It is more correct in vue3?