-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Fix cloneDeep with circularly dependent Sets/Maps #3123
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
I had this under the QUnit.test('`_.cloneDeep` should deep clone maps and sets with circular references', function(assert) {
assert.expect(2);
if (Set) {
var object = { x: new Set };
object.x.add(object);
var clone = _.cloneDeep(object);
assert.ok(lodashStable.isEqual(object, clone));
} else {
skipAssert(assert);
}
if (Map) {
var object = { x: new Map };
object.x.set('y', object);
var clone = _.cloneDeep(object);
assert.ok(lodashStable.isEqual(object, clone));
} else {
skipAssert(assert);
}
}); |
Awesome!!!! |
i'm experiencing this issue as well with lodash 4.17.10 in our production setup:
unfortunately, even with sourcemaps i can't really pinpoint where this happens exactly and with what kind of data exactly. i suspect it's when |
Hi @phoet! If you can manage a repro that would be great! This fix is in 4.17.10 so that means it could be elsewhere. We do recursively call |
@jdalton thanks for the hint and pointing to a workaournd. will see if i can find the data that is causing this. |
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
I've submitted a patch below. Let me know how it should be improved! I couldn't find the tests (probably because of the work on v5?), but I wrote a passing test on the 4.17.4 release. I'll paste it below.
Fixes #3122