These are chat archives for canjs/canjs

15th
Apr 2015
Adam L Barrett
@BigAB
Apr 15 2015 00:23

What would be the proper System map and paths configuration for using canjs from bower with the latest steal? I can’t seem to make it work.
trying with

“paths”:
        "can/*" : "bower_components/canjs/steal/can/*.js”
}

just gives me an error:

Error loading "can/control/modifier/key/key" from “app/main” at

The cjs and amd dirs do different errors. Is there a proper way?

Matthew Phillips
@matthewp
Apr 15 2015 00:57
i'm guessing that is a plugin that we aren't packaging in bower currently
Adam L Barrett
@BigAB
Apr 15 2015 00:58
Ohhh a plugin… that may be it
Matthew Phillips
@matthewp
Apr 15 2015 01:00
I guess that's a bug, we went over all of the known plugins but maybe that one was missed
Adam L Barrett
@BigAB
Apr 15 2015 01:06
And another can/util/function/function

Well I guess there was this:

warning: can/control/modifier/key is an undocumented and untested plugin and will be removed in a future release.

But who really listens to those anyway. :)

Matthew Phillips
@matthewp
Apr 15 2015 01:38
yeah but if it was in 2.1 it should still be there
Justin Love
@JustinLove
Apr 15 2015 16:37
http://canjs.com/2.1/docs/can.Model.html doesn't have the detail block in left nav for methods and such.
How do I force a can.Model to update from the server? It's making the request, getting back updated data, and then handing me an old object. (2.1.4)
Justin Love
@JustinLove
Apr 15 2015 16:56
The issue may actually be that it's updating the existing model, but not removing deleted items from a child list.
Justin Meyer
@justinbmeyer
Apr 15 2015 19:07
@JustinLove created an issue
about the docs
@JustinLove I think you need this: http://canjs.com/docs/can.Model.removeAttr.html
which is in 2.1
@akagomez you should start using jsbin instead of jsfiddle
Also, I don't know what your case is
skimming that code doesn't really tell me much
Justin Love
@JustinLove
Apr 15 2015 19:40
FYI the Bitovi blog has a post about 2.2, but the Canjs blog does not.
Matthew Phillips
@matthewp
Apr 15 2015 19:43
the canjs blog is going away
Justin Love
@JustinLove
Apr 15 2015 22:06
I tried updating to 2.2 (immediate reason is list sort)
First issue: a change event that used to fire once fired nine times, once for each deep property add. Workaround is to get the event params and filter those out.
Chris Gomez
@akagomez
Apr 15 2015 22:08
@justinbmeyer Care to share your reasonings for one vs the other?
Justin Love
@JustinLove
Apr 15 2015 22:09
Blocking issue: null element in appendChild of inserted.js, line 42 of amd-dev version when updating a list property from a findAll.
Justin Meyer
@justinbmeyer
Apr 15 2015 22:10
a list property?
Justin Love
@JustinLove
Apr 15 2015 22:10
This might be same thing, or not; it's hard to tell through the jsbin wrapper: http://jsbin.com/misoku/1/edit?html,js,output
@justinbmeyer a scope/viewModel property which contains a list of items. Sorry, that could have been read wrong.
Justin Meyer
@justinbmeyer
Apr 15 2015 22:12
in that example
```
Thing.findAll({}, function(things) {
        console.log(things)
        this.attr('things', things)
      })
this is not going to be the viewModel
      var self = this;
      Thing.findAll({}, function(things) {
        console.log(things)
        self.attr('things', things)
      })
Justin Love
@JustinLove
Apr 15 2015 22:13
Ah yes. Real one has variable, I'll fix the jsbin and see what happens.
Justin Meyer
@justinbmeyer
Apr 15 2015 22:13
fixing the JSBin works
So, someone at Bitovi seemingly has a similar null element / appendChild problem
if you can create a small test case, we can fix it asap
Justin Love
@JustinLove
Apr 15 2015 22:15
Well, I can try adding more layers of components
Justin Meyer
@justinbmeyer
Apr 15 2015 22:15
First issue: a change event that used to fire once fired nine times, once for each deep property add. Workaround is to get the event params and filter those out.
for that, can you create something that shows that too?
I wouldn't think that something like this should happen
deep properties are always fired if you are listening to a "change" event
btw, you probably shouldn't listen to "change" events if it can be avoided
Justin Love
@JustinLove
Apr 15 2015 22:16
I'll see. I didn't trace down the root cause. I think it's because I used an empty object as a stub until the real one got fetched.
Justin Meyer
@justinbmeyer
Apr 15 2015 22:17
yeah, but upgrading to 2.2 shouldn't really change how many events are fired
only events might be fired in a "more correct order"
Justin Love
@JustinLove
Apr 15 2015 22:17
It's possible I didn't notice all the changes before, but each change causes the findAll, so I probably would have noticed.
Justin Meyer
@justinbmeyer
Apr 15 2015 22:18
hmm, you are listening to a change and firing a findAll ?
would it be better to assemble the params in a getter
and then when that getter changes, fire findAll?
Justin Love
@JustinLove
Apr 15 2015 22:19
Actually I should probably just set the object id instead of the whole object; but it was a behavior change.
I arranged an object for the state that matters, but listening to the reduced parameters may be better still.
Justin Meyer
@justinbmeyer
Apr 15 2015 22:20
with 2.2, you can do something like:
define: {
  items: function(){
    var params = { param1: this.attr("param1"), param2: this.attr("param2") }
    return Model.findAll(params)
  }
}
and items should only update when param1 and param2 are updated
and if you update them within a batch
items will only be re-calculated once
One thing we could do is allow people to configure when a "change" happens. We could make it so if a compute's value changes to a new object, but that object has all the same properties and values ... a change does not happen.
You can "kinda" do this already
like:
Justin Meyer
@justinbmeyer
Apr 15 2015 22:28
define: {
  params: {
    Value: can.Map,
    get: function(params){
     params.attr({ param1: this.attr("param1"), param2: this.attr("param2") }) ;
     return params;
    }
  },
  items: {
    get: function(){
      return Model.findAll(this.attr("params").attr())
    }
  }
}