Loaders #588
-
Firstly , sorry for my english :DDD I recently started using graphql and I am unable to resolve nested loaders. I searched for hours on google and I didnt find anything that would work. Im trying to add isFriend field to all users and get this error
This is how my schema looks like
-------> Resolvers <---------
-------> Loaders <---------
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments
-
It's hard to answer without a full reproducible example, howerver I think theproblem is that you are not returning an array of booleans: loaders : {
User : {
isFriend : {
loader : async ( queries , ctx ) => {
const friends = [ 1, 3 ];
return queries.map(({ obj }) => {
if( friends.includes( obj.id ) ) {
return true;
}
return false;
});
},
opts : {
cache : false
}
}
}
}, |
Beta Was this translation helpful? Give feedback.
-
You're right , thanks a lot |
Beta Was this translation helpful? Give feedback.
It's hard to answer without a full reproducible example, howerver I think theproblem is that you are not returning an array of booleans: