These are chat archives for canjs/canjs

11th
Oct 2016
Chasen Le Hara
@chasenlehara
Oct 11 2016 17:21
Hey team, what’s the best way of expressing an optional define value in Can 2.3?
I have a property defined similar to prop: {Type: Map} but if I call removeAttr(‘prop’) I want it to be undefined
Right now, when I remove the property, it creates a new Map instance.
Which I totally understand, but I’m curious what the best way of expressing “no value or if there’s a value it’s of this type.”
Justin Meyer
@justinbmeyer
Oct 11 2016 19:45
@chasenlehara is that a bug?
if you do removeAttr("prop") prop should be undefined
so I'm not totally sure what you mean
(I'd be very surprised if this bug exists)
Chasen Le Hara
@chasenlehara
Oct 11 2016 19:47
prop is in a view model for a component, which is two-way bound to a parent component’s view model which has the same Type definition
Justin Meyer
@justinbmeyer
Oct 11 2016 19:48
ah, this is involved with two-way binding
Chasen Le Hara
@chasenlehara
Oct 11 2016 19:48
Yeah
Justin Meyer
@justinbmeyer
Oct 11 2016 19:48
so which version of CanJS?
2.3.27?
I thought we back ported this fix to 2.3
but even if we didn't you can create your own type converter
that will pass undefined and null through
Chasen Le Hara
@chasenlehara
Oct 11 2016 19:49
I have 2.3.26 installed in the project right now.
I can check with 2.3.27 if you think there was a change that’d affect this.
[It looks like there are from the changelog.]
Justin Meyer
@justinbmeyer
Oct 11 2016 19:53
ok, let me know if that fixes it
Chasen Le Hara
@chasenlehara
Oct 11 2016 19:56
Will do, thanks for the help
Chasen Le Hara
@chasenlehara
Oct 11 2016 20:25
Hey @justinbmeyer, doesn’t look like 2.3.27 solves the issue so I created a JS Bin: http://jsbin.com/boriqiseca/1/edit?html,js,output
I added some comments to the bottom of the code that explains it a bit more.
I’m not sure if it’s a bug or not; if it is, I’d be happy to file an issue, otherwise I’m just looking for advice on how you would handle this.
Thomas Sieverding
@Bajix
Oct 11 2016 23:56
Is the latest can-set backwards compatible w/ can-connect 0.5.5?