feat(reactivity): proxyRefs method and ShallowUnwrapRefs type (#1682)
* feat(reactivity): `proxyRefs` method and `ShallowUnwrapRefs` type BREAKING CHANGE: template auto ref unwrapping are now applied shallowly, i.e. only at the root level. See https://github.com/vuejs/vue-next/pull/1682 for more details.
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { VNode, VNodeChild, isVNode } from './vnode'
|
||||
import {
|
||||
reactive,
|
||||
ReactiveEffect,
|
||||
pauseTracking,
|
||||
resetTracking,
|
||||
shallowReadonly
|
||||
shallowReadonly,
|
||||
proxyRefs
|
||||
} from '@vue/reactivity'
|
||||
import {
|
||||
CreateComponentPublicInstance,
|
||||
@@ -548,7 +548,7 @@ export function handleSetupResult(
|
||||
}
|
||||
// setup returned bindings.
|
||||
// assuming a render function compiled from template is present.
|
||||
instance.setupState = reactive(setupResult)
|
||||
instance.setupState = proxyRefs(setupResult)
|
||||
if (__DEV__) {
|
||||
exposeSetupStateOnRenderContext(instance)
|
||||
}
|
||||
|
||||
@@ -10,12 +10,12 @@ import {
|
||||
} from '@vue/shared'
|
||||
import {
|
||||
ReactiveEffect,
|
||||
UnwrapRef,
|
||||
toRaw,
|
||||
shallowReadonly,
|
||||
ReactiveFlags,
|
||||
track,
|
||||
TrackOpTypes
|
||||
TrackOpTypes,
|
||||
ShallowUnwrapRef
|
||||
} from '@vue/reactivity'
|
||||
import {
|
||||
ExtractComputedReturns,
|
||||
@@ -154,7 +154,7 @@ export type ComponentPublicInstance<
|
||||
$nextTick: typeof nextTick
|
||||
$watch: typeof instanceWatch
|
||||
} & P &
|
||||
UnwrapRef<B> &
|
||||
ShallowUnwrapRef<B> &
|
||||
D &
|
||||
ExtractComputedReturns<C> &
|
||||
M &
|
||||
|
||||
@@ -8,6 +8,7 @@ export {
|
||||
readonly,
|
||||
// utilities
|
||||
unref,
|
||||
proxyRefs,
|
||||
isRef,
|
||||
toRef,
|
||||
toRefs,
|
||||
@@ -125,6 +126,7 @@ export {
|
||||
ComputedRef,
|
||||
WritableComputedRef,
|
||||
UnwrapRef,
|
||||
ShallowUnwrapRef,
|
||||
WritableComputedOptions,
|
||||
ToRefs,
|
||||
DeepReadonly
|
||||
|
||||
Reference in New Issue
Block a user