These are chat archives for canjs/canjs

22nd
Mar 2017
RyanMilligan
@RyanMilligan
Mar 22 2017 22:01
Hi! I'm having a problem with models disappearing from our list when we call save(). I've tracked it down to what appears to be a bug in can-set and would appreciate some guidance.
Kevin Phillips
@phillipskevin
Mar 22 2017 22:02
if you can open an issue in can-set with an example we can definitely take a look
RyanMilligan
@RyanMilligan
Mar 22 2017 22:04
Well, it seems like such a crazy bug that I'm kind of assuming that I'm misinterpreting something, or that there's something simple that I'm doing wrong.
Kevin Phillips
@phillipskevin
Mar 22 2017 22:05
ok, is it possible to show an example in a JSBin?
RyanMilligan
@RyanMilligan
Mar 22 2017 22:05
Basically, when the real-time behavior calls canSet.has(), it's throwing an error that the property 'id' is not defined. I tracked it down to the id function in set-core.js, which is failing because this.clauses is undefined. The thing is, "this" is the window object.
The function gets called from subsetComparesType() in compare.js through a variable without binding a this value.
The call:
var compareResult = compares(a, b, aParent, bParent, prop, options);
The function it's calling:
id: function(props){ var keys = Object.keys(this.clauses.id); if(keys.length === 1) { return props[keys[0]]; } else { var id = {}; keys.forEach(function(key){ id[key] = props[key]; }); return JSON.stringify(id); } }
RyanMilligan
@RyanMilligan
Mar 22 2017 22:11
That looks like it would have the same issue, but in my case it's getting called on line 180.
Gira Minus
@gKreator
Mar 22 2017 22:12
Can u paste bin ur models js file?
RyanMilligan
@RyanMilligan
Mar 22 2017 22:13
It's a big file, but I can give you one of the models that's standalone and has the problem. Give me a moment.
RyanMilligan
@RyanMilligan
Mar 22 2017 22:21
Shoot, I have to go. Thanks for looking at this, if that's not enough information I'll look at opening an issue tomorrow.