Fix applySnapshot to map<string,boolean> bug#155
Fix applySnapshot to map<string,boolean> bug#155mattiamanzati merged 3 commits intomobxjs:masterfrom
Conversation
Primitive types removes from the map on applySnapshot if key exists.
const Store = types.model('Store', {
tags: types.map(types.boolean),
})
let store = Store.create({tags: {admin: true}})
console.log(JSON.stringify(getSnapshot(store)))
applySnapshot(store, {tags: {admin: true}})
console.log(JSON.stringify(getSnapshot(store)))
applySnapshot(store, {tags: {admin: true}})
console.log(JSON.stringify(getSnapshot(store)))
Output:
{"tags":{"admin":true}}
{"tags":{}}
{"tags":{"admin":true}}
|
Thanks a lot for this PR! |
mattiamanzati
left a comment
There was a problem hiding this comment.
Please add a test for this case, so with futher changes we can be sure to not break the expected behaviour :)
it should be the same each time
|
I added one test. Thank you! |
|
Thanks for your effort! |
Primitive types removes from the map on applySnapshot if key exists.