Fix add in array reusing existing element as oldValue
This commit is contained in:
parent
e2ffd04e6e
commit
9b2b8233af
|
@ -166,7 +166,9 @@ export function add (json, path, value, options) {
|
|||
const resolvedPath = resolvePathIndex(json, path)
|
||||
const parent = getIn(json, initial(path))
|
||||
const parentIsArray = Array.isArray(parent)
|
||||
const oldValue = getIn(json, resolvedPath)
|
||||
const oldValue = parentIsArray
|
||||
? undefined
|
||||
: getIn(json, resolvedPath)
|
||||
const newValue = options.fromJSON(value, oldValue)
|
||||
|
||||
const updatedJson = parentIsArray
|
||||
|
|
Loading…
Reference in New Issue