These are chat archives for js-data/js-data

9th
Oct 2015
Jason Dobry
@jmdobry
Oct 09 2015 03:52
@MikaAK Fixed #236 in 2.6.0
@pdemilly Doesn't matter, as a special setter is defined that will just modify the localKey for you
@raderj89 You could make the request yourself.
Pascal DeMilly
@pdemilly
Oct 09 2015 04:01

@jmdobry Actually I have been banging my head against a bug. I have a relationship defined like this:

name: 'team',
relations: {
   hasMany: {
         users: {
                 localField: 'members',
                  localKeys: 'member_ids',
                  foreignKey: 'id'
         }
    }
}

The problem happens when I use ui-select to select the members in a team. I am getting a looping error:

Uncaught Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [[{"msg":"fn: ngModelWatch","newVal":[],"oldVal":[]}],[{"msg":"fn: ngModelWatch","newVal":[],"oldVal":"..."}],[{"msg":"fn: ngModelWatch","newVal":[],"oldVal":"..."}],[{"msg":"fn: ngModelWatch","newVal":[],"oldVal":"..."}],[{"msg":"fn: ngModelWatch","newVal":[],"oldVal":"..."}]]
http://errors.angularjs.org/1.4.7/$rootScope/infdig?p0=10&p1=%5B%5B%7B%22ms…gModelWatch%22%2C%22newVal%22%3A%5B%5D%2C%22oldVal%22%3A%22...%22%7D%5D%5DREGEX_STRING_REGEXP @ angular.js:68parent.$get.Scope.$digest @ angular.js:15864parent.$get.Scope.$apply @ angular.js:16097(anonymous function) @ ag-grid.js:5279
2015-10-08 21:00:50.154 angular.js:12477 Error: [$rootScope:infdig] 10 $digest() iterations reached. Aborting!
Watchers fired in the last 5 iterations: [[{"msg":"fn: ngModelWatch","newVal":[],"oldVal":[]}],[{"msg":"fn: ngModelWatch","newVal":[],"oldVal":"..."}],[{"msg":"fn: ngModelWatch","newVal":[],"oldVal":"..."}],[{"msg":"fn: ngModelWatch","newVal":[],"oldVal":"..."}],[{"msg":"fn: ngModelWatch","newVal":[],"oldVal":"..."}]]
http://errors.angularjs.org/1.4.7/$rootScope/infdig?p0=10&p1=%5B%5B%7B%22ms…gModelWatch%22%2C%22newVal%22%3A%5B%5D%2C%22oldVal%22%3A%22...%22%7D%5D%5D
    at REGEX_STRING_REGEXP (angular.js:68)
    at Scope.parent.$get.Scope.$digest (angular.js:15864)
    at Scope.parent.$get.Scope.$apply (angular.js:16097)
    at tick (angular.js:11292)(anonymous function) @ angular.js:12477ident.$get @ angular.js:9246parent.$get.Scope.$apply @ angular.js:16099tick @ angular.js:11292

The only way I found to get it working is to populate the list of ids (localKeys).

Jason Dobry
@jmdobry
Oct 09 2015 04:02
You can't use localKeys and foreignKey together. Use one or the other.
Pascal DeMilly
@pdemilly
Oct 09 2015 04:07
That's interesting. I hadn't read it. I tried so many combination. Thought originally the problem was with ui-select. I am going to refactor and see if I bind to scope it helps
thx
Jason Dobry
@jmdobry
Oct 09 2015 04:08
np
Pascal DeMilly
@pdemilly
Oct 09 2015 05:26
well that explains why I was having problems while binding: angular-ui/ui-select#665
Zeeshan
@zeesulehria
Oct 09 2015 09:29
Hi, I am building an application where I need to handle interesting multi-client synchronization use-cases, both in online and offline mode. After initial brief overview of the js-data documentation, one thing is not clear yet:
What event-driven mechanism does js-data support to synchronization changes from the server made by some other user. Refresh APIs support polling based synchronization, is there any support for an event driven down-link synchronization mechanism as well?
Zeeshan
@zeesulehria
Oct 09 2015 09:35
Support for something like websockets to notify individual clients about changes in the main data source?
David Paquet Pitts
@davidpp
Oct 09 2015 15:11
@zeesulehria you can easily inject new data in the right store each time you receive an update, but you will still have to build that support yourself
Jason Dobry
@jmdobry
Oct 09 2015 15:41
@zeesulehria In the past I've done something like this: https://github.com/js-data/js-data/issues/44#issuecomment-72946719
David Paquet Pitts
@davidpp
Oct 09 2015 15:54
@jmdobry just curious, in your example why do you broadcast on $rootScope. Was it before js-data emitted it’s own events or ?
Jason Dobry
@jmdobry
Oct 09 2015 15:56
I don't remember why, that was a while ago
I might have put that in there just for the example
Sean Lynch
@techniq
Oct 09 2015 16:19
Is it possible to send a query string param as part of an action?
I have the following resource:
DS.defineResources({
  name: 'channels',
  actions: {
    summary: {}
  }
}
I tried Channel.summary({userId: currentUser.id})
but it just calls /channels/summary and not channels/summary?userId=1234
Jason Dobry
@jmdobry
Oct 09 2015 16:21
Channel.summary({ params: { userId: currentUser.id } })
Sean Lynch
@techniq
Oct 09 2015 16:22
@jmdobry thanks
@jmdobry thanks for releasing js-data-sql ;)
Jason Dobry
@jmdobry
Oct 09 2015 16:24
np
Zeeshan
@zeesulehria
Oct 09 2015 19:03
@jmdobry @davidpp Great. Thanks for your help. Seems like js-data is really gonna make my life easier. I am just starting out on js-data. Thanks again for your great work! :+1: