This repository was archived by the owner on Feb 27, 2024. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +28
-21
lines changed Expand file tree Collapse file tree 3 files changed +28
-21
lines changed Original file line number Diff line number Diff line change
1
+ // Query partial: retrieve comment fields.
2
+ const commentsFields = `
3
+ edges {
4
+ node {
5
+ databaseId
6
+ content(format: RENDERED)
7
+ parentDatabaseId
8
+ approved
9
+ id
10
+ date
11
+ parentId
12
+ commentId
13
+ type
14
+ }
15
+ }
16
+ `
17
+ export default commentsFields
Original file line number Diff line number Diff line change
1
+ import commentsFields from './commentsFields'
2
+
3
+ // Query partial: retrieve comment post fields.
4
+ const commentsPostFields = `
5
+ comments(first: 10) {
6
+ ${ commentsFields }
7
+ }
8
+ `
9
+ export default commentsPostFields
Original file line number Diff line number Diff line change 1
1
import { gql } from '@apollo/client'
2
2
import archivePageInfo from '../_partials/archivePageInfo'
3
-
4
- // Fragment: retrieve comment fields.
5
- const commentFragment = gql `
6
- fragment CommentFields on Comment {
7
- databaseId
8
- content(format: RENDERED)
9
- parentDatabaseId
10
- approved
11
- id
12
- date
13
- parentId
14
- commentId
15
- type
16
- }
17
- `
3
+ import commentsFields from '../_partials/commentsFields'
18
4
19
5
// Query: retrieve comments by post databaseId.
20
6
const queryCommentsByPostId = gql `
@@ -35,14 +21,9 @@ const queryCommentsByPostId = gql`
35
21
where: {contentId: $id, order: $order, orderby: $orderby}
36
22
) {
37
23
${ archivePageInfo }
38
- edges {
39
- node {
40
- ...CommentFields
41
- }
42
- }
24
+ ${ commentsFields }
43
25
}
44
26
}
45
- ${ commentFragment }
46
27
`
47
28
48
29
export default queryCommentsByPostId
You can’t perform that action at this time.
0 commit comments