vuejs / composition-api

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

fix: dynamically update deep scopedSlot refs #899

Closed chearon closed 2 years ago

chearon commented 2 years ago

764 works perfectly when you're using normal slots, but not if you forward scoped slots to a child component.

Unfortunately, and I hope I'm mistaken about this, every component's entire VNode tree has to be iterated to find a component that needs refs updated.

Here's some perf testing of this PR in our application. In the Firefox profiler, afterRender shows up for:

Ideally this would use Vue's patch hooks like native Vue 2 refs do. Would it be out of the question to introduce a faster v-ref= instead of this PR? Or is this fast enough given that the readme already warns about performance issues?