Unable to get current instance after rendering another component in setup
Vue version
3.2.41
Link to minimal reproduction
https://codesandbox.io/s/tender-carson-78f4nw
Steps to reproduce
Run the minimal reproduction, then observe the console, there is no app mounted
, also the judgment of the instance is also print false
What is expected?
app mounted called, and get the instance anywhere in the setup
What is actually happening?
lost my component instance after another component rendered
System Info
no
Any additional comments?
no
I don't think this is a good idea, you should use a Teleport component instead. Is there anything blocking you from using Teleport?
Teleport component is not only a declarative component, but also I can't make it singleton. In many ui frameworks there are components rendered by functional calls, such as Notification. I don't think Teleport component is suitable for every situations.
Note that the declarative approach is often the preferred way and that you could perfectly do the same you are doing with a Teleport component and an array of notifications
I understand, but this situation should also be covered and paid attention to, a large number of frameworks are also used in this way. Using an array to store the instance covers this situation perfectly and doesn't cost a lot, poping and pushing performance is very fast, I think fix this will make Vue3 more robust.