Skip to content

Commit

Permalink
refactor(reactivity): use explicit assignments. (#4401)
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangenming committed Aug 23, 2021
1 parent ebd0bac commit 9043d0d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions packages/reactivity/src/ref.ts
Expand Up @@ -79,7 +79,7 @@ export function ref<T extends object>(value: T): ToRef<T>
export function ref<T>(value: T): Ref<UnwrapRef<T>>
export function ref<T = any>(): Ref<T | undefined>
export function ref(value?: unknown) {
return createRef(value)
return createRef(value, false)
}

export function shallowRef<T extends object>(
Expand All @@ -98,7 +98,7 @@ class RefImpl<T> {
public dep?: Dep = undefined
public readonly __v_isRef = true

constructor(value: T, public readonly _shallow = false) {
constructor(value: T, public readonly _shallow: boolean) {
this._rawValue = _shallow ? value : toRaw(value)
this._value = _shallow ? value : convert(value)
}
Expand All @@ -118,7 +118,7 @@ class RefImpl<T> {
}
}

function createRef(rawValue: unknown, shallow = false) {
function createRef(rawValue: unknown, shallow: boolean) {
if (isRef(rawValue)) {
return rawValue
}
Expand Down

0 comments on commit 9043d0d

Please sign in to comment.