|
|
@@ -182,15 +182,18 @@ class RefImpl<T = any> {
|
|
|
* @see {@link https://vuejs.org/api/reactivity-advanced.html#triggerref}
|
|
|
*/
|
|
|
export function triggerRef(ref: Ref): void {
|
|
|
- if (__DEV__) {
|
|
|
- ;(ref as unknown as RefImpl).dep.trigger({
|
|
|
- target: ref,
|
|
|
- type: TriggerOpTypes.SET,
|
|
|
- key: 'value',
|
|
|
- newValue: (ref as unknown as RefImpl)._value,
|
|
|
- })
|
|
|
- } else {
|
|
|
- ;(ref as unknown as RefImpl).dep.trigger()
|
|
|
+ // ref may be an instance of ObjectRefImpl
|
|
|
+ if ((ref as unknown as RefImpl).dep) {
|
|
|
+ if (__DEV__) {
|
|
|
+ ;(ref as unknown as RefImpl).dep.trigger({
|
|
|
+ target: ref,
|
|
|
+ type: TriggerOpTypes.SET,
|
|
|
+ key: 'value',
|
|
|
+ newValue: (ref as unknown as RefImpl)._value,
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ ;(ref as unknown as RefImpl).dep.trigger()
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|