-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Correctly handle hashing of objects that return non-objects from valueOf() #1654
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
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need the corporate CLA signed. If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
To pick up the fix in immutable-js/immutable-js#1654.
…shcode. I don't think the fix from immutable-js/immutable-js#1654 is quite complete – either that or `Post.fromJSON` is doing something non-deterministic.
Is this ever going to be incorporated? Or is the position of immutable that they will not support this use case (in particular, using moment() ) |
I don't know :/ For me it wasn't moment, it was a Decimal, but it breaks for anything that implements @asazernik do you have any insight about what I can do to get this merged? |
The problem is easy to reproduce with Date. It looks like any value greater than This makes Immutable completely break for our application, and we've had to refactor away all uses of Immutable Set. Hopefully this PR can get merged and a new rc released soon. const { Set } = require("immutable")
const bad = []
let set = Set()
let i = 0
while (true) {
i++
try {
set = set.add(new Date(i))
console.log(i, "is ok")
} catch (err) {
console.log(i, err.message)
bad.push(i)
}
if (bad.length > 100) {
console.log(bad)
break
}
} |
@leebyron You were the last one to complete a merge into this repo, so is there any chance to get this fix merged in? Or is there anyone else we can tag to get this resolved? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing this locally worked for me. LGTM
Lack of activity and commit history suggest this repo died on Valentine’s Day 2019 :/ RIP, even true, immutable-love isn’t forever 💔 |
@aaronwhite it kind of goes into hibernation, and then gets a burst of pulls every month or three. |
Can someone please merge this? The regression is 9 months old, and this fix was requested 8 months ago. Is @leebyron still the maintainer, or is there someone else who can commit this? |
@EricTheRed-VT It honestly looks like this project is proper dead. It's been 5 months since a commit, and I haven't seen a single person with merge authority so much as comment. My recommendation is to move off of this library entirely sooner rather than later. |
@TikiTDO We're pretty happy with it in general, aside from the rare bug like this. Dropping Immutable would be too costly for my team, not to mention that there isn't a good replacement library (that I'm aware of). If this really never gets fixed, we might have to fork it and maintain a private version. 😞 It's just hard to believe that a widely popular library like this would be completely abandoned. |
Fixes #1643.
JSFiddle showing the issue: https://jsfiddle.net/ey7opm1w
The problem is described well by @joakim-hagglund in this comment: #1643 (comment)
The return value from
valueOf
was being passed tohashJSObj
, and subsequently failing because non-objects cannot be used as keys in aWeakMap
.