Comparing version 7.0.12 to 7.0.13
{ | ||
"name": "immer", | ||
"version": "7.0.12", | ||
"version": "7.0.13", | ||
"description": "Create your next immutable state by mutating the current one", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
@@ -21,2 +21,3 @@ import { | ||
} from "../internal" | ||
import {isDraft} from "../utils/common" | ||
@@ -133,3 +134,7 @@ interface ProxyBaseState extends ImmerBaseState { | ||
}, | ||
set(state, prop: string /* strictly not, but helps TS */, value) { | ||
set( | ||
state: ProxyObjectState, | ||
prop: string /* strictly not, but helps TS */, | ||
value | ||
) { | ||
const desc = getDescriptorFromProto(latest(state), prop) | ||
@@ -142,11 +147,15 @@ if (desc?.set) { | ||
} | ||
state.assigned_[prop] = true | ||
if (!state.modified_) { | ||
// the last check is because we need to be able to distinguish setting a non-existig to undefined (which is a change) | ||
// from setting an existing property with value undefined to undefined (which is not a change) | ||
if ( | ||
is(value, peek(latest(state), prop)) && | ||
(value !== undefined || has(state.base_, prop)) | ||
) | ||
const current = peek(latest(state), prop) | ||
// special case, if we assigning the original value to a draft, we can ignore the assignment | ||
const currentState: ProxyObjectState = current?.[DRAFT_STATE] | ||
if (currentState && currentState.base_ === value) { | ||
state.copy_![prop] = value | ||
state.assigned_[prop] = false | ||
return true | ||
} | ||
if (is(value, current) && (value !== undefined || has(state.base_, prop))) | ||
return true | ||
prepareCopy(state) | ||
@@ -157,2 +166,3 @@ markChanged(state) | ||
state.copy_![prop] = value | ||
state.assigned_[prop] = true | ||
return true | ||
@@ -159,0 +169,0 @@ }, |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Deprecated
MaintenanceThe maintainer of the package marked it as deprecated. This could indicate that a single version should not be used, or that the package is no longer maintained and any new vulnerabilities will not be fixed.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
90015
24
2596
1