You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The findAll function is called with an empty where.in array
The findAll function is called with duplicates in the where.in array
These two cases are -at best- very inefficient or problematic depending on the actual adapter being used and the endpoints (ex: the js-data-http might fail because an API is not expecting an empty in clause or duplicated).
I have my own adapter that extends js-data-adapter so I have played with fixes and simply filtering out duplicates or not calling findAll if keys is empty works well.
I can work on a PR if you would accept it.
The text was updated successfully, but these errors were encountered:
jawadst
changed the title
Empty key or duplicate keys
Empty key or duplicate keys when loading relations
Aug 28, 2017
@jawadst we're working on a v4 release - If you're interested in contributing on this issue with a PR there is already a branch rewritten in TS, v4. 👍🏼
When loading relations (I have been using belongsTo relations mostly),
js-data-adapter
does not check for empty or duplicate keys before callingfindAll
(example for belongsTo: https://github.com/js-data/js-data-adapter/blob/release/src/index.js#L817).This results in cases where:
findAll
function is called with an emptywhere.in
arrayfindAll
function is called with duplicates in thewhere.in
arrayThese two cases are -at best- very inefficient or problematic depending on the actual adapter being used and the endpoints (ex: the
js-data-http
might fail because an API is not expecting an emptyin
clause or duplicated).I have my own adapter that extends
js-data-adapter
so I have played with fixes and simply filtering out duplicates or not callingfindAll
if keys is empty works well.I can work on a PR if you would accept it.
The text was updated successfully, but these errors were encountered: