From 847b7303278c7894e5d6b055e0e654f6cf809330 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
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/components/Comment/Comment.tsx | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

(limited to 'src/components/Comment/Comment.tsx')

diff --git a/src/components/Comment/Comment.tsx b/src/components/Comment/Comment.tsx
index 0371288..e20c5aa 100644
--- a/src/components/Comment/Comment.tsx
+++ b/src/components/Comment/Comment.tsx
@@ -67,7 +67,10 @@ const Comment = ({
   const getApprovedComment = () => {
     return (
       <>
-        <article className={styles.wrapper} id={`comment-${comment.commentId}`}>
+        <article
+          className={styles.wrapper}
+          id={`comment-${comment.databaseId}`}
+        >
           <header className={styles.header}>
             {comment.author.gravatarUrl && (
               <div className={styles.avatar}>
@@ -89,7 +92,7 @@ const Comment = ({
             </dt>
             <dd>
               <time dateTime={comment.date}>
-                <Link href={`#comment-${comment.commentId}`}>
+                <Link href={`#comment-${comment.databaseId}`}>
                   <a>{getLocaleDate()}</a>
                 </Link>
               </time>
@@ -118,7 +121,7 @@ const Comment = ({
         {shouldOpenForm && (
           <DynamicCommentForm
             articleId={articleId}
-            parentId={comment.commentId}
+            parentId={comment.databaseId}
           />
         )}
         {comment.replies.length > 0 && (
@@ -127,7 +130,7 @@ const Comment = ({
               return (
                 <Comment
                   articleId={articleId}
-                  key={reply.commentId}
+                  key={reply.databaseId}
                   comment={reply}
                   isNested={true}
                 />
@@ -152,7 +155,7 @@ const Comment = ({
 
   const schemaJsonLd: WithContext<CommentSchema> = {
     '@context': 'https://schema.org',
-    '@id': `${settings.url}/#comment-${comment.commentId}`,
+    '@id': `${settings.url}/#comment-${comment.databaseId}`,
     '@type': 'Comment',
     parentItem: isNested
       ? { '@id': `${settings.url}/#comment-${comment.parentDatabaseId}` }
-- 
cgit v1.2.3

