From 847b7303278c7894e5d6b055e0e654f6cf809330 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 9 Mar 2022 23:23:47 +0100 Subject: 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 --- src/utils/helpers/format.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/utils') 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] ); } }); -- cgit v1.2.3