Skip to content

Loaders #588

Answered by mcollina
ajmerik121 asked this question in Q&A
Sep 28, 2021 · 2 comments
Discussion options

You must be logged in to vote

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
                }
            }
        }
    },

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by ajmerik121
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants