hi there, when I make a query ( I'm trying to get ...
# prisma-whats-new
v
hi there, when I make a query ( I'm trying to get posts but they are didn't created yet ) I have an error
Copy code
const getPosts = graphql(GET_POSTS, {
    options: {
        variables: {
            first: 3
        }
    },
    alias: 'GetPostsAlias',
    props: ({data: { loading, fetchMore, allPosts } }) => {
        return {
            loading,
            allPosts,
            loadMorePosts(id, next) {
                let variables = {
                    last: 1,
                    before: id,
                };
                if(next){
                    variables = {
                        first: 1,
                        after: id
                    }
                }
                return fetchMore({
                    query: GET_POSTS,
                    variables,
                    updateQuery: (previousResult, { fetchMoreResult }) => {
                        if (!fetchMoreResult.allPosts.length) { return previousResult; }
                        return {
                            ...previousResult,
                            allPosts: next
                                ?[...previousResult.allPosts, ...fetchMoreResult.allPosts]
                                :[...fetchMoreResult.allPosts, ...previousResult.allPosts]
                        }
                    },
                });
            }
        };
    }
});
Error : Unhandled (in react-apollo:GetPostsAlias(Apollo(BrowseScreen))) Error: GraphQL error: Cannot return null for non-nullable type (line 10, column 5): How to fix this ?
j
What bpolerplate are you using
v
graphcool