vuejs / composition-api

Composition API plugin for Vue 2
https://composition-api.vuejs.org/
MIT License
4.19k stars 343 forks source link

`$scopedSlots` is not mirrored correctly in `context.slots` #911

Closed tomasz-pucka closed 2 years ago

tomasz-pucka commented 2 years ago

Version

1.4.9

Reproduction link

Vue 2 Comparison with Vue 3 If there are some issues with running the preview, try to refresh it using the refresh button in the console.

Steps to reproduce

Toggle the checkbox in the preview and observe the conditionally rendered content and slot objects values in the console. Try to change the initial showSlots value in the App component to false and observe the difference.

What is expected?

The context.slots property should be updated when slots are rendered conditionally and contain up-to-date value in the updated hook. Behaviour should be identical to the vue 3 example.

What is actually happening?

The value of context.slots doesn't seem to be updated after component initialization.

github-actions[bot] commented 2 years ago

Stale issue message

tomasz-pucka commented 2 years ago

Any updates on this issue?

skytt commented 2 years ago

The same problem.... got empty context.slots object when the slot was updated after mounted lifecycle. Using getCurrentInstance().vnode.componentInstance.$scopedSlots.default?.({}) can get the current slots content, but context.slots cannot