Skip to content

Commit

Permalink
refactor(reactivity): remove redundant variable declaration
Browse files Browse the repository at this point in the history
  • Loading branch information
inottn committed Feb 4, 2025
1 parent 82da43d commit bf4bdaa
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions packages/reactivity/src/baseHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -146,13 +146,12 @@ class MutableReactiveHandler extends BaseReactiveHandler {
): boolean {
let oldValue = target[key]
if (!this._isShallow) {
const isOldValueReadonly = isReadonly(oldValue)
if (!isShallow(value) && !isReadonly(value)) {
oldValue = toRaw(oldValue)
value = toRaw(value)
}
if (!isArray(target) && isRef(oldValue) && !isRef(value)) {
if (isOldValueReadonly) {
if (isReadonly(oldValue)) {
return false
} else {
oldValue.value = value
Expand Down

0 comments on commit bf4bdaa

Please sign in to comment.