Skip to content

Commit

Permalink
fix(devtools): send instance to devtools when it's mounted instead of…
Browse files Browse the repository at this point in the history
… created
  • Loading branch information
Akryum committed Jan 29, 2021
1 parent d224753 commit 4fecb27
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 0 additions & 5 deletions packages/runtime-core/src/component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ import {
markAttrsAccessed
} from './componentRenderUtils'
import { startMeasure, endMeasure } from './profiling'
import { devtoolsComponentAdded } from './devtools'

export type Data = Record<string, unknown>

Expand Down Expand Up @@ -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
}

Expand Down
10 changes: 9 additions & 1 deletion packages/runtime-core/src/renderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit 4fecb27

Please sign in to comment.