diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-03-09 23:23:47 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-03-09 23:23:47 +0100 |
| commit | 847b7303278c7894e5d6b055e0e654f6cf809330 (patch) | |
| tree | 1145c488ee0580eeb0709863c98f6ef2f413f478 /src/utils/helpers/format.ts | |
| parent | 5b6639a3cf9b6c63045cb82e6ef1a43b0742c367 (diff) | |
refactor: update graphql queries (#14)
* refactor: replace postBy query
postBy is now deprecated in WPGraphQL v1.7
* refactor: update post comments query
PostBy is deprecated and it is now possible to use the post ID to query
comments.
* refactor: update get topic by slug query
topicBy is deprecated
* refactor: update get thematic by slug query
thematicBy is deprecated
Diffstat (limited to 'src/utils/helpers/format.ts')
| -rw-r--r-- | src/utils/helpers/format.ts | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/utils/helpers/format.ts b/src/utils/helpers/format.ts index 71455b6..dd35868 100644 --- a/src/utils/helpers/format.ts +++ b/src/utils/helpers/format.ts @@ -189,15 +189,15 @@ export const buildCommentsTree = (comments: Comment[]) => { const commentsTree: Comment[] = []; comments.forEach( - (comment) => (hashTable[comment.commentId] = { ...comment, replies: [] }) + (comment) => (hashTable[comment.databaseId] = { ...comment, replies: [] }) ); comments.forEach((comment) => { if (!comment.parentDatabaseId) { - commentsTree.push(hashTable[comment.commentId]); + commentsTree.push(hashTable[comment.databaseId]); } else { hashTable[comment.parentDatabaseId].replies.push( - hashTable[comment.commentId] + hashTable[comment.databaseId] ); } }); |
