File tree Expand file tree Collapse file tree 1 file changed +3
-4
lines changed
packages/runtime-core/src Expand file tree Collapse file tree 1 file changed +3
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { isFunction } from '@vue/shared'
2
- import { currentInstance } from './component'
3
- import { currentRenderingInstance } from './componentRenderContext'
2
+ import { currentInstance , getCurrentInstance } from './component'
4
3
import { warn } from './warning'
5
4
6
5
export interface InjectionKey < T > extends Symbol { }
@@ -45,14 +44,14 @@ export function inject(
45
44
) {
46
45
// fallback to `currentRenderingInstance` so that this can be called in
47
46
// a functional component
48
- const instance = currentInstance || currentRenderingInstance
47
+ const instance = getCurrentInstance ( )
49
48
if ( instance ) {
50
49
// #2400
51
50
// to support `app.use` plugins,
52
51
// fallback to appContext's `provides` if the instance is at root
53
52
const provides =
54
53
instance . parent == null
55
- ? instance . vnode . appContext && instance . vnode . appContext . provides
54
+ ? instance . vnode . appContext ? .provides
56
55
: instance . parent . provides
57
56
58
57
if ( provides && ( key as string | symbol ) in provides ) {
You can’t perform that action at this time.
0 commit comments