Open
Description
What problem does this feature solve?
When getCurrentInstance
is used within app.runWithContext
- top-level component instance should be returned (if it already exists). This should allow easier usage of Vue features outside components.
This behavior can currently be 'emulated' with app.provide
, but it feels like there should be no need for this workaround.
runWithContext
was first introduced in #7451
What does the proposed API look like?
const app = createApp(App)
app.mount('#app')
app.runWithContext(() => {
getCurrentInstance() === app._instance // true
})