Return null cursor when creating comment

This commit is contained in:
Chi Vinh Le
2018-09-06 00:14:47 +02:00
parent 4d860ab71d
commit f5e0c6163d
4 changed files with 8 additions and 5 deletions
@@ -39,7 +39,7 @@ beforeEach(() => {
.returns({
// TODO: add a type assertion here to ensure that if the type changes, that the test will fail
edge: {
cursor: "2018-07-06T18:24:00.000Z",
cursor: null,
node: {
id: "comment-x",
author: users[0],
@@ -39,7 +39,7 @@ beforeEach(() => {
})
.returns({
edge: {
cursor: "2018-07-06T18:24:00.000Z",
cursor: null,
node: {
id: "comment-x",
author: users[0],
@@ -9,8 +9,11 @@ const Mutation: GQLMutationTypeResolver<void> = {
const comment = await ctx.mutators.Comment.create(input);
return {
edge: {
// FIXME: (wyattjoh) when we're using a replies/respect sort, it is index based instead of date based, needs some work!
cursor: comment.created_at,
// (cvle)
// Depending on the sort we can't determine the accurate cursor
// in a performant way, so we return null instead.
// It seems that Relay does not directly use this value...
cursor: null,
node: comment,
},
clientMutationId: input.clientMutationId,
@@ -679,7 +679,7 @@ type CommentEdge {
"""
"""
cursor: Cursor!
cursor: Cursor
}
"""