Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"type": "minor",
"comment": "optimize a \"preloader pattern\" where one operation explicitly covers selection of several other operations",
"packageName": "@graphitation/apollo-forest-run",
"email": "vrazuvaev@microsoft.com_msteamsmdb",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
query CommentsList($postId: ID!, $first: Int!, $after: String) {
...CommentsListFragment
}

fragment CommentsListFragment on Query {
post(id: $postId) {
id
comments(first: $first, after: $after) {
edges {
node {
id
body
createdAt
author {
id
name
avatarUrl
}
reactions {
id
type
user {
id
name
}
}
}
cursor
}
pageInfo {
hasNextPage
endCursor
}
totalCount
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
query PostHeader($postId: ID!) {
...PostHeaderFragment
}

fragment PostHeaderFragment on Query {
post(id: $postId) {
id
title
subtitle
publishedAt
coverImageUrl
author {
id
name
avatarUrl
bio
}
tags {
id
name
slug
}
stats {
viewCount
likeCount
commentCount
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
query PostPreloader($postId: ID!, $first: Int!, $after: String) @cache(covers: ["CommentsList", "PostHeader"]) {
...PostHeaderFragment
...CommentsListFragment
}

fragment PostHeaderFragment on Query {
post(id: $postId) {
id
title
subtitle
publishedAt
coverImageUrl
author {
id
name
avatarUrl
bio
}
tags {
id
name
slug
}
stats {
viewCount
likeCount
commentCount
}
}
}

fragment CommentsListFragment on Query {
post(id: $postId) {
id
comments(first: $first, after: $after) {
edges {
node {
id
body
createdAt
author {
id
name
avatarUrl
}
reactions {
id
type
user {
id
name
}
}
}
cursor
}
pageInfo {
hasNextPage
endCursor
}
totalCount
}
}
}
Loading
Loading