Skip to content

Commit 4fecb27

Browse files
committed
fix(devtools): send instance to devtools when it's mounted instead of created
1 parent d224753 commit 4fecb27

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

packages/runtime-core/src/component.ts

-5
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ import {
5656
markAttrsAccessed
5757
} from './componentRenderUtils'
5858
import { startMeasure, endMeasure } from './profiling'
59-
import { devtoolsComponentAdded } from './devtools'
6059

6160
export type Data = Record<string, unknown>
6261

@@ -486,10 +485,6 @@ export function createComponentInstance(
486485
instance.root = parent ? parent.root : instance
487486
instance.emit = emit.bind(null, instance)
488487

489-
if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
490-
devtoolsComponentAdded(instance)
491-
}
492-
493488
return instance
494489
}
495490

packages/runtime-core/src/renderer.ts

+9-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,11 @@ import { createHydrationFunctions, RootHydrateFunction } from './hydration'
7272
import { invokeDirectiveHook } from './directives'
7373
import { startMeasure, endMeasure } from './profiling'
7474
import { ComponentPublicInstance } from './componentPublicInstance'
75-
import { devtoolsComponentRemoved, devtoolsComponentUpdated } from './devtools'
75+
import {
76+
devtoolsComponentAdded,
77+
devtoolsComponentRemoved,
78+
devtoolsComponentUpdated
79+
} from './devtools'
7680
import { initFeatureFlags } from './featureFlags'
7781
import { isAsyncWrapper } from './apiAsyncComponent'
7882

@@ -1412,6 +1416,10 @@ function baseCreateRenderer(
14121416
}
14131417
instance.isMounted = true
14141418

1419+
if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
1420+
devtoolsComponentAdded(instance)
1421+
}
1422+
14151423
// #2458: deference mount-only object parameters to prevent memleaks
14161424
initialVNode = container = anchor = null as any
14171425
} else {

0 commit comments

Comments
 (0)