different results when using SI's set and merge
niksosf opened this issue · comments
Hi there I encountered this inexplicable difference when using seamless immutable's set and merge. For example
let item = store.getState().items[0] // --> an immutable item {price: 100}
afterItemA = item.set('price', 123) // {price: 123}
afterItemB = item.merge({price: 456}) // {price: 456}
// Updating with the merged object
store.dispatch({
type: 'ITEMS_UPDATE_START',
record: afterItemB,
})
// then a generic ajax request is made to backend and we get a response 'res'
store.dispatch({
type: 'ITEMS_UPDATE_SUCCESS',
record: res
})
let item = store.getState().items[0] // --. It STILL is a seamless immutable js object
// updating with the set object
store.dispatch({
type: 'ITEMS_UPDATE_START',
record: afterItemA,
})
// same everything ajax request and calling dispatch with ITEMS_UPDATE_SUCCESS, BUT:
let item = store.getState().items[0] // --. It IS NO LONGER a seamless immutable js object
Is there a reason why?
Thank you!
I don't have an explanation for this, I will have to put a test together to try to replicate this issue
This is no longer relevant in v2