Hi Team,
I’m trying to make a reply to the particular reply comment but its not happening. Its considering as a separate comment and adding a reply to that comment.
Let me explain the scenario in detail with my example and schema.
Schema:
type Post {
id: ID!
title: String! @search(by: [fulltext])
timestamp: DateTime! @search
body: String!
comments: [Comment] @hasInverse(field: post)
}
type Comment {
id: ID!
message: String! @search(by: [fulltext])
post: Post @hasInverse(field: comments)
timestamp: DateTime! @search
replyComment: [Comment] @hasInverse(field: replyComment)
}
Response:
{
"data": {
"getPostById": {
"success": true,
"message": "PostId is retrieved successfully",
"data": {
"id": "0x4bafc",
"title": "test data",
"timestamp": "2021-04-20T06:45:46.218Z",
"body": " This is my #message",
"comments": [
{
"id": "0x4bb00",
"message": "test welcome",
"timestamp": "2021-04-20T06:47:52.964Z",
"replyComment": []
},
{
"id": "0x4bb02",
"message": "edited comments",
"timestamp": "2021-04-20T06:48:11.2Z",
"replyComment": [
{
"id": "0x4bb04",
"message": "reply comment slash",
"timestamp": "2021-04-20T06:52:07.692Z"
}
]
},
{
"id": "0x4bb04",
"message": "reply comment slash",
"timestamp": "2021-04-20T06:52:07.692Z",
"replyComment": [
{
"id": "0x4bb06",
"message": "edited reply comment slash",
"timestamp": "2021-04-20T06:53:41.2Z"
}
]
}
]
}
}
}
}
Let us consider that I’m trying to make a reply comment for the id: “0x4bb04” . Instead of mapping the reply comment under the id: “0x4bb04”, its considering as a separate comment and adding the reply to it. Threading is not happening here.
Expected Response:
{
"data": {
"getPostById": {
"success": true,
"message": "PostId is retrieved successfully",
"data": {
"id": "0x4bafc",
"title": "test data",
"timestamp": "2021-04-20T06:45:46.218Z",
"body": " This is my #message",
"comments": [
{
"id": "0x4bb00",
"message": "test welcome",
"timestamp": "2021-04-20T06:47:52.964Z",
"replyComment": []
},
{
"id": "0x4bb02",
"message": "edited comments",
"timestamp": "2021-04-20T06:48:11.2Z",
"replyComment": [
{
"id": "0x4bb04",
"message": "reply comment slash",
"timestamp": "2021-04-20T06:52:07.692Z",
"replyComment": [
{
"id": "0x4bb06",
"message": "edited reply comment slash",
"timestamp": "2021-04-20T06:53:41.2Z"
}
]
}
]
}
]
}
}
}
}
Kindly help me to fix the issue.
Nested mutation is not happening for more than one level.
Linked Referred:
https://github.com/graphql/graphql-spec/issues/91
Thanks and Regards
Yuvaraj.