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

Records with same properties from different factories aren't equal #152

Closed Methuselah96 closed 3 years ago

Methuselah96 commented 4 years ago

From @NickLydon on Mon, 23 Sep 2019 14:50:55 GMT

Identical records created using different factories return on .equals(): v3.8.2: true v4.0.0-rc.12: false This change may be intentional, but I couldn't determine that from the documentation. Here's some sample code:

import {Record} from 'immutable';

const factoryA = Record({ id: '' });
const factoryB = Record({ id: '' });

console.log('factoryA equals factoryA', factoryA().equals(factoryA()));
console.log('factoryA equals factoryB', factoryA().equals(factoryB()));

and the stackblitz for it

Copied from original issue: https://github.com/immutable-js/immutable-js/issues/1734