immutable-js-oss / immutable-js

Immutable persistent data collections for Javascript which increase efficiency and simplicity.
https://immutable-js-oss.github.io/immutable-js/
MIT License
37 stars 6 forks source link

prevent withMutations from setting values on non defined record keys #200

Closed jdeniau closed 3 years ago

jdeniau commented 3 years ago

A PR was present on immutable-js original repository by @Brantron in https://github.com/immutable-js/immutable-js/issues/1544. I just cherry-picked the commit.

It is compatible with IE9+.

Fixes #79

Methuselah96 commented 3 years ago

Part of the issue also seemed to be that const r1 = rec.set('wtf', '?'); should throw an error, but it doesn't, which this PR doesn't fix. Maybe I'm reading that incorrectly?

jdeniau commented 3 years ago

@Methuselah96 according to this test, this has been changed from "throwing an error" to "do nothing".

Both set and withMultation + set now have the same comportment. It looks to me that this is fixed

jdeniau commented 3 years ago

Superseeded by the original PR : https://github.com/immutable-js/immutable-js/pull/1544