Quellcode durchsuchen

wip: remove immutability conversion in inject

Evan You vor 6 Jahren
Ursprung
Commit
c5558b7ed1
1 geänderte Dateien mit 3 neuen und 5 gelöschten Zeilen
  1. 3 5
      packages/runtime-core/src/apiInject.ts

+ 3 - 5
packages/runtime-core/src/apiInject.ts

@@ -1,6 +1,4 @@
 import { currentInstance } from './component'
-import { immutable } from './apiReactivity'
-import { isObject } from '@vue/shared'
 
 export interface InjectionKey<T> extends Symbol {}
 
@@ -31,8 +29,8 @@ export function inject(key: InjectionKey<any> | string, defaultValue?: any) {
   } else {
     // TODO should also check for app-level provides
     const provides = currentInstance.parent && currentInstance.provides
-    const val =
-      provides && key in provides ? (provides[key as any] as any) : defaultValue
-    return __DEV__ && isObject(val) ? immutable(val) : val
+    return provides && key in provides
+      ? (provides[key as any] as any)
+      : defaultValue
   }
 }