Trigger microagents on agent keywords
What problem or use case are you trying to solve?
Currently microagents are triggered when the user mentions a keyword, but not when an agent mentions a keyword.
Describe the UX of the solution you'd like
Mentions of keywords by the agent should trigger the microagent.
Is this really a bug? I do not think so. As long as you execute the slot functions in setup, you will get this warning, which has nothing to do with whether you use functional components to wrap it.
import { createApp, h, defineComponent } from 'vue'
const Comp = defineComponent({
setup(props, { slots }) {
// a warning raised, this is as expected
const s = slots.default && slots.default()
return () => s
}
})
createApp({
setup() {
return () => h(Comp, () => 'sss')
}
}).mount('#header')
@HcySunYang But then I should get the warning too when I execute the MyComponent directly in App.vue (instead of MyContainer), right? But then there is no warning. so something seems to be wrong there...
A little bit of context of the bigger picture what I try to accomblish: I want to tell the parent component if any of the child components are considered "empty" (based on their data AND slot content). In vue2 those slots where just empty when no element was rendered (with functional components), but since vue3 I can't tell if the component has a v-if="false" on the root element. I just see the an array with the components or in some cases an entry of type "Symbol(Comment)" ($el is not accessible).
So I guess I have to use provide and inject. But those need to be performed in setup (and not in render). So there seems to be no other way to invoke the slot function in setup, to determine if there is something to show.
Ok, I made a PR to make the warning consistent when calling the slot function outside the render function.
However, more and more users request similar capabilities. They hope to call the slot function in the setup function to determine whether the slot content exists or meets expectations. Maybe we don’t need to report that warning message, but instead, emphasize it in the document.
Fixed since 3.2.0
Repros in 3.2.0: https://codesandbox.io/p/sandbox/vue-warns-incorrectly-if-component-is-surrounded-by-functional-component-3257-rdvzmh