theom
05/20/2017, 9:37 AMGraphQL error: Unknown directive 'defer'. (line 8, column 39): comments(orderBy: createdAt_DESC) @defer error message.
My query is as follows:
export const All_Posts_Comments_Query = gql`
query allPostsCommentsQuery {
allPostses (orderBy: createdAt_DESC) {
__typename
id
displaysrc
caption
likes
comments (orderBy: createdAt_DESC) @defer {
__typename
id
posts {
__typename
id
}
text
user
deleted
}
}
}
`;
https://dev-blog.apollodata.com/new-features-in-graphql-batch-defer-stream-live-and-subscribe-7585d0c28b07nilan
05/23/2017, 7:36 AMtheom
05/23/2017, 10:07 AMnilan
05/23/2017, 10:11 AMtheom
05/23/2017, 10:48 AMThis is a proposal for a new directive called defer, which is intended to minimize the time to first data. When you have a large GraphQL query for your UI, you might currently need to wait for the whole result to be generated by the server and sent over the wire to see any of it on the screen. But with defer, you can specify that some part of the query can arrive later.
So, and using my query above, when the query is initiated I would only get back all posts for initial UI rendering, followed by a subsequent 2nd server response which would then fetch all comments.nilan
05/23/2017, 12:38 PM