Skip to content

Undocumented breaking change in v4: equal Node buffers no longer considered equal #1437

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

Closed
callumlocke opened this issue Nov 7, 2017 · 1 comment
Milestone

Comments

@callumlocke
Copy link

What happened

Until v3, Immutable.is treated two collections containing equivalent Node Buffers as equal, because Node buffers happen to have an .equals() method similar to an Immutable collection.

In v4, this is no longer the case.

How to reproduce

Try the following with Immutable v3 and v4:

import { is, Map } from 'immutable'

const a = Map({
  'foo.txt': Buffer.from('hello')
})

const b = Map({
  'foo.txt': Buffer.from('hello')
})

is(a, b) // true in v3, but false in v4

Summary

This change may be a good thing, as the old behaviour always felt a little magical. And I'm not sure if it was ever officially documented. But @leebyron once told me (in #720) that the old behaviour was desirable, even if accidental. So if this change is intentional, I think it should be flagged up in the release notes as a breaking change.

@leebyron
Copy link
Collaborator

Documented in the latest release notes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants