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 11import { isFunction } from '@vue/shared'
2- import { currentInstance } from './component'
3- import { currentRenderingInstance } from './componentRenderContext'
2+ import { currentInstance , getCurrentInstance } from './component'
43import { currentApp } from './apiCreateApp'
54import { warn } from './warning'
65
@@ -51,7 +50,7 @@ export function inject(
5150) {
5251 // fallback to `currentRenderingInstance` so that this can be called in
5352 // a functional component
54- const instance = currentInstance || currentRenderingInstance
53+ const instance = getCurrentInstance ( )
5554
5655 // also support looking up from app-level provides w/ `app.runWithContext()`
5756 if ( instance || currentApp ) {
@@ -90,5 +89,5 @@ export function inject(
9089 * user. One example is `useRoute()` in `vue-router`.
9190 */
9291export function hasInjectionContext ( ) : boolean {
93- return ! ! ( currentInstance || currentRenderingInstance || currentApp )
92+ return ! ! ( getCurrentInstance ( ) || currentApp )
9493}
You can’t perform that action at this time.
0 commit comments