immutable-js-oss/immutable-js

Records with same properties from different factories aren't equal

Closed this issue · 0 comments

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: immutable-js#1734