[BUG] Directives in slots aren't resolved in the correct context #541
Description
Reported in discord but it never went anywhere.
🐛 Bug description
If you run this you get Cannot read properties of undefined (reading 'deep')
because the directive is being resolved in CompA instead of CompB
@yyx990803 said:
The problem is where the JSX compiler generates the resolveDirective call - it should be resolved in parent render function root scope: https://template-explorer.vuejs.org/#eyJzcmMiOiI8Q29tcD5cblx0PGRpdiB2LWZvby8+XG48L0NvbXA+Iiwib3B0aW9ucyI6eyJob2lzdFN0YXRpYyI6dHJ1ZSwiY2FjaGVIYW5kbGVycyI6dHJ1ZX19
🏞 Desired result
The directive should be resolved at the top level rather than inline. I'm not sure if this is even possible because JSX can be used anywhere so there isn't really an easy way to determine what the "render function root scope" is. Maybe slotFlags need to be disabled if a directive is used?
🚑 Other information
Kinda related, implicit default slots don't emit slotFlags:
implicit slot: https://vue-jsx-explorer.netlify.app/#%3CComp%3E%0A%20%20%3Cdiv%20v-foo%20%2F%3E%0A%3C%2FComp%3E
explicit slot: https://vue-jsx-explorer.netlify.app/#%3CComp%3E%0A%20%20%7B%7B%0A%20%20%20%20default%3A%20()%20%3D%3E%20%3Cdiv%20v-foo%20%2F%3E%0A%20%20%7D%7D%0A%3C%2FComp%3E