]> git.ipfire.org Git - thirdparty/vuejs/core.git/commitdiff
fix(devtools): send instance to devtools when it's mounted instead of created
authorGuillaume Chau <guillaume.b.chau@gmail.com>
Fri, 29 Jan 2021 15:48:37 +0000 (16:48 +0100)
committerGuillaume Chau <guillaume.b.chau@gmail.com>
Fri, 29 Jan 2021 15:48:37 +0000 (16:48 +0100)
packages/runtime-core/src/component.ts
packages/runtime-core/src/renderer.ts

index 3904bbb13390d6da4fac2c159eff23eb918a920b..494ae41dc47aa4c386925c575cb80c15e2f28433 100644 (file)
@@ -56,7 +56,6 @@ import {
   markAttrsAccessed
 } from './componentRenderUtils'
 import { startMeasure, endMeasure } from './profiling'
-import { devtoolsComponentAdded } from './devtools'
 
 export type Data = Record<string, unknown>
 
@@ -486,10 +485,6 @@ export function createComponentInstance(
   instance.root = parent ? parent.root : instance
   instance.emit = emit.bind(null, instance)
 
-  if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
-    devtoolsComponentAdded(instance)
-  }
-
   return instance
 }
 
index da86040d0a15782bf622bec909efb5ebe699e050..898ae077d78cf0c171ce799fa98339fe3f42e574 100644 (file)
@@ -72,7 +72,11 @@ import { createHydrationFunctions, RootHydrateFunction } from './hydration'
 import { invokeDirectiveHook } from './directives'
 import { startMeasure, endMeasure } from './profiling'
 import { ComponentPublicInstance } from './componentPublicInstance'
-import { devtoolsComponentRemoved, devtoolsComponentUpdated } from './devtools'
+import {
+  devtoolsComponentAdded,
+  devtoolsComponentRemoved,
+  devtoolsComponentUpdated
+} from './devtools'
 import { initFeatureFlags } from './featureFlags'
 import { isAsyncWrapper } from './apiAsyncComponent'
 
@@ -1412,6 +1416,10 @@ function baseCreateRenderer(
         }
         instance.isMounted = true
 
+        if (__DEV__ || __FEATURE_PROD_DEVTOOLS__) {
+          devtoolsComponentAdded(instance)
+        }
+
         // #2458: deference mount-only object parameters to prevent memleaks
         initialVNode = container = anchor = null as any
       } else {