jaystack / jaydata

Notice: this library isn't maintained anymore
http://jaydata.org
GNU General Public License v2.0
352 stars 94 forks source link

v1.5.5 RC find() + include() error #256

Open gabrielsimplicio opened 8 years ago

gabrielsimplicio commented 8 years ago

Hi, I'm using jaydata v1.5.5 RC + odata v4, but I can't use

context.EntityName.include("Relationship").find(id).then(...)

In v1.4.0 it worked. Thanks.

robesz commented 8 years ago

Hello @gabrielsimplicio , What's the error or what does "I can't use" mean? Please elaborate the issue and we resolve it accordingly.

anderslyman commented 8 years ago

@robesz I just ran into this as well, the error I see is:

TypeError: Cannot read property 'length' of undefined(…)

Debugging a bit, it looks like it enters the VisitFindExpression in jaydata.js, at which point this: if (source !== expression.source) return _index.Container.createFindExpression(source); Evaluates as false, so even though the expression entered this function with params populated, it is substituted with the source expression which does not have params populated.

Then when it hits this line in the VisitFindExpression function in the oDataProvider.js (line 335): if (expression.params.length === 1) {

It throws an error since params is undefined (even though I've passed an Id).

anderslyman commented 8 years ago

btw, I'm on the 1.5.5 RC

I'm available to do a screenshare if that would be helpful