Skip to content

Commit 2b52d5d

Browse files
committed
fix(devtools): expose root instance
related to vuejs/devtools-v6#1376
1 parent ade9bd9 commit 2b52d5d

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

packages/runtime-core/src/apiCreateApp.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ import {
22
ConcreteComponent,
33
Data,
44
validateComponentName,
5-
Component
5+
Component,
6+
ComponentInternalInstance
67
} from './component'
78
import {
89
ComponentOptions,
@@ -46,6 +47,7 @@ export interface App<HostElement = any> {
4647
_props: Data | null
4748
_container: HostElement | null
4849
_context: AppContext
50+
_instance: ComponentInternalInstance | null
4951

5052
/**
5153
* v2 compat only
@@ -186,6 +188,7 @@ export function createAppAPI<HostElement>(
186188
_props: rootProps,
187189
_container: null,
188190
_context: context,
191+
_instance: null,
189192

190193
version,
191194

@@ -296,6 +299,7 @@ export function createAppAPI<HostElement>(
296299
;(rootContainer as any).__vue_app__ = app
297300

298301
if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
302+
app._instance = vnode.component
299303
devtoolsInitApp(app, version)
300304
}
301305

@@ -314,6 +318,7 @@ export function createAppAPI<HostElement>(
314318
if (isMounted) {
315319
render(null, app._container)
316320
if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
321+
app._instance = null
317322
devtoolsUnmountApp(app)
318323
}
319324
delete app._container.__vue_app__

0 commit comments

Comments
 (0)