Skip to content

Commit

Permalink
fix(reactivity): fix ref mutation debugger event values
Browse files Browse the repository at this point in the history
  • Loading branch information
yyx990803 committed Jul 28, 2020
1 parent 0b3b1cf commit b7ef38b
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions packages/reactivity/src/ref.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,15 @@ function createRef(rawValue: unknown, shallow = false) {
if (hasChanged(toRaw(newVal), rawValue)) {
rawValue = newVal
value = shallow ? newVal : convert(newVal)
trigger(
r,
TriggerOpTypes.SET,
'value',
__DEV__ ? { newValue: newVal } : void 0
)
trigger(r, TriggerOpTypes.SET, 'value', newVal)
}
}
}
return r
}

export function triggerRef(ref: Ref) {
trigger(
ref,
TriggerOpTypes.SET,
'value',
__DEV__ ? { newValue: ref.value } : void 0
)
trigger(ref, TriggerOpTypes.SET, 'value', __DEV__ ? ref.value : void 0)
}

export function unref<T>(ref: T): T extends Ref<infer V> ? V : T {
Expand Down

0 comments on commit b7ef38b

Please sign in to comment.