New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot compare object will null prototype #64
Comments
Upstream issue in |
Just checking in on this - |
Hey, I do realise that this PR hasn't been merged upstream, but do you have any objections to applying this diff to |
Hi @NMinhNguyen -- we'll look into taking the proposed fix and tests directly when we have a chance (maybe next week?) |
Sure, no rush! Thank you for getting back to me :) My main hesitation with raising a PR was that I'm not sure if there's any significant performance impact from the additional |
#123 is up for review if anyone wants to kick the tires on it? |
Thank you so much for this! What's the best way to do so? By patching the dependency with the diff from the PR? |
If you're using Or, worst case just manually replace |
One more note about behavior here which is now called out in the tests: // See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object#null-prototype_objects
{
description: 'Object.create(null) equal to vanilla null prototype deep objects',
value1: Object.assign(Object.create(null), { a: 1, b: { c: true } }),
value2: { __proto__: null, a: 1, b: { c: true } },
equal: true
},
// Object.create(null) has a different `constructor` than a vanilla, non-null object.
{
description: 'Object.create(null) unequal to vanilla deep objects',
value1: Object.assign(Object.create(null), { a: 1, b: { c: true } }),
value2: { a: 1, b: { c: true } },
equal: false
}, Namely, |
@ryan-roemer can confirm it's working now :) thanks once again! |
- Allow use of `Object.create(null)` to work without error. Fixes #64 - Add customized tests.
Fixed in |
Objects created using Object.create(null) break when used inside isEqual
react-fast-compare/index.js
Line 76 in 8253fc8
The text was updated successfully, but these errors were encountered: